homepage Welcome to WebmasterWorld Guest from 54.237.125.89
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
remove characters up to specific character
Pollos




msg:4264365
 8:48 pm on Feb 8, 2011 (gmt 0)

I need to remove all characters up to specific character in a string. I've searched in vain for a answer, so I hope you can help me.

It's to build a index/sitemap automatically

I have code that looks through specific directory's and outputs a list of contents:-

<li><a href="http://'path/to'.$filename.'">'.ucfirst($menuitem).'</a></li>

$filename = name_of_file.htm
$menuitem = name_of_file [.htm and '_' stripped]

My problem is the site is in two languages so ideally I'd like:-

<li><a href="http://'path/to'.$filename.'">'.ucfirst($menuitem).'<br />'.ucfirst($second_menuitem).'</a></li>

$filename = 'English_name~Spanish_name.htm'
$menuitem = 'English_name'
$second_menuitem = 'Spanish_name'

I've worked out how to strip everything after a the "~", but can't fathom how to strip everything before the "~"

Any help would be much appreciated.

 

Kings on steeds




msg:4264980
 5:47 am on Feb 10, 2011 (gmt 0)


list($one,$two) = split('~',$filename);

$menu_one = $one;
$menu_two = str_replace('.html','',$two);


Not sure if its what your after, but the above will pass 'English_name' to $menu_one and 'Spanish_name' to $menu_two

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved