Page 1 of 1

Help With Code Function

Posted: Thu Sep 27, 2007 7:24 am
by paceace
Can I make this Array output

Code: Select all

<a href=\"getperson.php?personID\">Individual </a>
output like this?

Code: Select all

$value = http://someurl.com/getperson.php?personID
$value_man = Individual
I can't get figure it out. anyone? I am sure it is simple for somebody, just not me.
all help appreciated.

Posted: Thu Sep 27, 2007 7:41 am
by Jenk
er.. what?

Sorry

Posted: Thu Sep 27, 2007 8:08 am
by paceace
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


, I Knew I wasn't being clear on this. I need to put some info in an RSS feed. 
The info is already going to another page. 
I need to use that information but it is in the wrong format. 
Here is all of the code

Code: Select all

<?php

$newroot = ereg_replace( "/", "", $rootpath );
$newroot = ereg_replace( " ", "", $newroot );
$newroot = ereg_replace( "\.", "", $newroot );
$ref = "tngbookmarks_$newroot";
?>
<?php

$bookmarks = explode("|", $_COOKIE[$ref]);
$bcount = 0;
$totalbookmarks = count($bookmarks);
if($totalbookmarks)
	
foreach( $bookmarks as $bookmark ) {
	if(trim($bookmark)) {
	echo "$bookmark \n";
	
$bcount++;
	}
}
if($totalbookmarks)
	
?>
<br />

<?php

?>
The code output, of echo $bookmark is

Code: Select all

<a href=\"getperson.php?personID\">Individual </a>
is not in a format I can use. I probably am not going to be able to do this, but I came really close a couple of times. using ereg_replace and str_replace


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

sorry

Posted: Thu Sep 27, 2007 10:49 am
by paceace
Sorry let me try again, and see if I can get it right.
This is the output I started with

Code: Select all

<a href=\"getperson.php?personID\">Individual </a>
So I am using str_replace

Code: Select all

<?php 
$value = array("ahref", );
$newbook = str_replace($value, "www.mydomain.com", "$bookmark");
$value_one = array("<a","\"","<",">", );
$bookmark = str_replace($value_one, "", "$newbook");
?>
Yes this is crude I know, but it outputs

Code: Select all

www.mydomain.com=\getpersonphp?personID=I09802&tree=pad\Individual

which is most of what I want.

The problem is, I can not get rid of the back slashes I tried stripslashes() but that did not work.
If I could just figure out how to get forward slashes to replace the backslashes I would be able to go from there.

Posted: Thu Sep 27, 2007 11:05 am
by feyd

Code: Select all

$foo = str_replace('\\', '/', $foo);

Thanks!

Posted: Thu Sep 27, 2007 11:28 am
by paceace
Thank you very much that did it!