Home »
Imported messages »
comp.lang.php »
simple url problem
Re: simple url problem [message #183046 is a reply to message #183043] |
Sat, 05 October 2013 05:09 |
Norman Peelman
Messages: 126 Registered: September 2010
Karma:
|
Senior Member |
|
|
On 10/04/2013 11:20 PM, richard wrote:
>
>
> I am trying to mimmick the tenplate shown.
> But I get a parse error where I have $myurl.
>
> I believe it is becaause of the dot.
> How do I work around this?
>
>
> <!-- single playlist entry as an "template" -->
> <a class="item" href="http://mroldies.net/videos/1960/summerplace.flv">
> A Summer Place - Movie Theme <span>Percy Fiath Orchestra</span>
> <em>1960 # 1</em>
> </a>
>
> <?php
>
> $aid=1;
>
> while ($aid<21)
> {
> echo "< a class='item'"
>
> $myurl='href="http://mroldies.net/videos/"';
> echo $myurl;
>
> echo "\n";
> echo $playme[$aid][0];
> echo "<span>";
> echo $playme[$aid][1];
> echo "</span>\n";
> echo "<em>$playme[$aid][2]</em>\n";
>
> echo "</a";
>
> $aid++;
> }
>
>
> ?>
>
$aid = 1;
while ($aid < 21)
{
$myurl = "<a class='item'
href='http://mroldies.net/videos/{$playme[$aid][0]}'\n<span>{$playme[$aid][1]}</span>\n<em>{$playme[$aid][2]}</em >\n</a>\n";
echo $myurl;
$aid++;
}
-or-
$aid = 1;
while ($aid < 21)
{
$myurl = "<a class='item' href='http://mroldies.net/video/";
$myurl .= "{$playme[$aid][0]}'\n ";
$myurl .= "<span>{$playme[$aid][1]}</span>\n";
$myurl .= "<em>{$playme[$aid][2]}</em>\n</a>\n";
echo $myurl;
$aid++;
}
-or HEREDOC syntax-
$aid = 1;
while ($aid < 21)
{
echo <<<HTML
<a class="item" href="http://mroldies.net/video/{$playme[$aid][0]}"
<span>{$playme[$aid][1]}</span>
<em>{$playme[$aid][2]}</em>
</a>
HTML;
$aid++;
}
Do what you like. My preference is to have my HTML (in code) look
pretty close to what I expect to see in the browser (view source).
--
Norman
Registered Linux user #461062
-Have you been to www.php.net yet?-
|
|
|
Goto Forum:
Current Time: Wed Nov 27 14:37:26 GMT 2024
Total time taken to generate the page: 0.04544 seconds