Jamroom Logo Jamroom 5 Core
is now Open Source!
User Support Forum Archive (Read Only)
User Site Design, Integration and Customization:
SONG_HISTORY bbcode parsing error
fingers



Joined: 14 Jan 2004
Posts: 22
Location: London

Posted: 03/06/04 04:54 
I am trying to include a snippet of the main SONG_HISTORY information on my artists music pages.

BBCode is messing with this and I wondered if anybody could point me in the right direction?

So in my song_footer.tpl I have put this function in to show just the first 250 characters of the SONG_HISTORY

<?php
$contents = "{SONG_HISTORY}";
// remove the bbcode url tags
$stripper = array("[url]", "[/url]" );
$contents = str_replace($stripper, "", $contents);
//find the first 250 characters of the SONG_HISTORY
$rest = substr($contents, 0, 250);?>
<?php echo $rest; ?>

This will work ok when i put in a bbcode url like this in the song history

[url]wwwmysite.com[/url]

but when I use [url]www.mysite.com[/url]

I get a parsing error...

Any ideas?

Thanx

Rich

peace

Back to top
Brian
Jamroom Team


Joined: 09 Jul 2003
Posts: 37583
Location: Seattle, WA

Posted: 03/06/04 10:24 

fingers:
I am trying to include a snippet of the main SONG_HISTORY information on my artists music pages.

BBCode is messing with this and I wondered if anybody could point me in the right direction?

So in my song_footer.tpl I have put this function in to show just the first 250 characters of the SONG_HISTORY

<?php
$contents = "{SONG_HISTORY}";
// remove the bbcode url tags
$stripper = array("[url]", "[/url]" );
$contents = str_replace($stripper, "", $contents);
//find the first 250 characters of the SONG_HISTORY
$rest = substr($contents,0,250);?>
<?php echo $rest; ?>

This will work ok when i put in a bbcode url like this in the song history

[url]wwwmysite.com[/url]

but when I use www.mysite.com

I get a parsing error...

Any ideas?

Thanx

Rich

peace


Rich -

by the time the "{SONG_HISTORY}" variable is put into the artist templates (.tpl) it has already been "expanded" so to speak to regular HTML. You might have a hard time getting the HTML to work properly that way since in effect you could cut it off in the middle of an open tag. Your best bet is to strip all html from the tag before you use it:


Code

<?php
$contents = strip_tags("{SONG_HISTORY}");
echo substr($contents, 0, 250);
?>


Let me know if that works for you. Hope this helps!

- Brian


_________________
Make sure and check out:
* The Jamroom FAQ
* The Jamroom Documentation
Back to top
fingers



Joined: 14 Jan 2004
Posts: 22
Location: London

Posted: 03/08/04 13:01 
Thanks Brian Very Happy

Unfortunately this didn't help... this caused a parsing error - even with no bbcode in the SONG_HISTORY

I have put a warning on this theme for my users - but i would love to find a way to do this.

Back to top
Brian
Jamroom Team


Joined: 09 Jul 2003
Posts: 37583
Location: Seattle, WA

Posted: 03/08/04 16:55 

fingers:
Thanks Brian Very Happy

Unfortunately this didn't help... this caused a parsing error - even with no bbcode in the SONG_HISTORY

I have put a warning on this theme for my users - but i would love to find a way to do this.


hmm... that bit of code shouldn't of caused a parsing error - did you perhaps add other code into the page at the same time? I'll check it out on the dev server here (that bit above wasn't tested) and make sure I didn't mess something up.

Thanks!

- Brian


_________________
Make sure and check out:
* The Jamroom FAQ
* The Jamroom Documentation
Back to top
fingers



Joined: 14 Jan 2004
Posts: 22
Location: London

Posted: 03/08/04 17:18 
I don't think there was any other code on the page. (apart from html)

Thanks Brian! This problem has been bugging me for quite a while - I really appreciate your help!

Back to top
Display posts from previous:   
User Support Forum Archive (Read Only)
User Site Design, Integration and Customization

 
Solutions
• Social Media Platform
• Social Networking Software
• Musician Website Manager
• Community Builder
Products
• Jamroom Core
• Jamroom Addons
• Jamroom Modules
• Jamroom Marketplace
Support
• Support Forum
• Documentation
• Support Center
• Contact Support
Community
• Community Forum
• Member Sites
• Developers
Company
• About Us
• Contact Us
• Privacy Policy
©2003 - 2010 Talldude Networks, LLC.