You are here: Re: [PHP] Displaying a html line as html « PHP « IT news, forums, messages
Re: [PHP] Displaying a html line as html

Posted by Todd Cary on 02/01/05 18:56

Jochem -

Here is the function:

/* Make page path */
function make_page_path($page_string, $script_name) {
$parts = explode('|', $page_string);
for ($i = 0; $i < count($parts); $i++) {
if ($i == 0) {
$page_path = '&lt;a href="' . $script_name . '"&gt;' .
$parts[$i] . '&lt;/a&gt;';
} else {
$page_path = $page_path . '->' . '&lt;a href="' . $script_name
.. '"&gt;' . $parts[$i] . '&lt;/a&gt;';
}
}
//print("Page_path: " . $page_path . "<br>");
return $page_path;
}

Here is the executing code:

$page_string = make_page_string($page_string, "Search");
$script_string = make_script_string($script_string, "search.php");
print("Page_string: " . $page_string . "<br>");
print("Script_string: " . $script_string . "<br>");
print("Url: " . $url . "<br>");
$page_path = make_page_path($page_string, $script_string, $url);
print($page_path);

To see it execute, this URL will do it:
http://209.204.172.137/casesearch/php/search.php?search_text=***&page_string=Home&script_string=home.php


The Title area contains

&nbsp;&nbsp;<? print($page_path); ?>


The function that creates the link(s) is


/* Make page path */
function make_page_path($page_string, $script_string, $path) {
$scripts = explode('|', $script_string);
$pages = explode('|', $page_string);
for ($i = 0; $i < count($scripts); $i++) {
if ($i < count($scripts) - 1) {
if ($i == 0) {
$page_path = '&lt;a href="' . $path . $scripts[$i] . '"&gt;'
.. $pages[$i] . '&lt;/a&gt;';
} else {
$page_path = $page_path . '-&gt;' . '&lt;a href="' . $path .
$scripts[$i] . '"&gt;' . $pages[$i] . '&lt;/a&gt;';
}
} else {
if ($i == 0) {
$page_path = $pages[$i];
} else {
$page_path = $page_path . '-&gt;' . $pages[$i];
}
}
}
//print("Page_path: " . $page_path . "<br>");
return $page_path;
}




Thank you for your help...

Todd

Jochem Maas wrote:
> Todd Cary wrote:
>
>> OK...I am close, but still missing something. The string returned by
>> the function is $page_path and it contains
>>
>> <a href="http://209.204.172.137/casesearch/php/search.php">Home</a>->
>
>
> ----^
> what ever else you function is doing this is probably not correct
>
>
>> <a href="http://209.204.172.137/casesearch/php/search.php">Search</a>
>>
>> And here is how the function is used:
>>
>
> funny thing is you don't show the code for the function - AND i willing to
> bet money that the function uses html_entities() - or an equivelant...
>
> you say the function returns:
>
> <a href="http://209.204.172.137/casesearch/php/home.php">Home</a>
>
> but that is bullshit (if everything else you say it true, namely a
> direct echo of the return
> value does not show a link), if you bother to look at your own source,
> then you
> will see that the string that is output is:
>
> &lt;a
> href=&quot;http://209.204.172.137/casesearch/php/home.php&quot;&gt;Home&lt;/a&gt;
>
>
> actually I noticed that the site had changed a little since I happened
> to look yesterday.
> today you are dumping some debug output at the top of the page, where as
> yesterday
> you we outputting the borked link next to the logo (the home link there
> now works - I suspect
> that this is because you have reverted to functionality there?)
>
>
> post the code for the make_page_path() function!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация