Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #11291

Re: simple url problem

From Norman Peelman <npeelman@cfl.rr.com>
Newsgroups comp.lang.php
Subject Re: simple url problem
Date 2013-10-05 01:09 -0400
Organization A noiseless patient Spider
Message-ID <l2o6ui$pgm$1@dont-email.me> (permalink)
References <1u7hl6faeyoet$.14yt7rp1zju49$.dlg@40tude.net>

Show all headers | View raw


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?-

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

simple url problem richard <noreply@example.com> - 2013-10-04 23:20 -0400
  Re: simple url problem richard <noreply@example.com> - 2013-10-04 23:28 -0400
    Re: simple url problem The Natural Philosopher <tnp@invalid.invalid> - 2013-10-05 08:55 +0100
      Re: simple url problem Norman Peelman <npeelman@cfl.rr.com> - 2013-10-05 07:43 -0400
  Re: simple url problem Norman Peelman <npeelman@cfl.rr.com> - 2013-10-05 01:09 -0400
    Re: simple url problem Denis McMahon <denismfmcmahon@gmail.com> - 2013-10-05 18:29 +0000
      Re: simple url problem Tim Streater <timstreater@greenbee.net> - 2013-10-05 22:51 +0100

csiph-web