simple url problem [message #183043] |
Sat, 05 October 2013 03:20 |
Mr Oldies
Messages: 241 Registered: October 2013
Karma: 0
|
Senior Member |
|
|
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++;
}
?>
|
|
|
Re: simple url problem [message #183044 is a reply to message #183043] |
Sat, 05 October 2013 03:28 |
Mr Oldies
Messages: 241 Registered: October 2013
Karma: 0
|
Senior Member |
|
|
Stupid me again.
forgot the ; at the end of the line above the error.
On Fri, 4 Oct 2013 23:20:29 -0400, 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++;
> }
>
>
> ?>
|
|
|
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: 0
|
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?-
|
|
|
Re: simple url problem [message #183048 is a reply to message #183044] |
Sat, 05 October 2013 07:55 |
The Natural Philosoph
Messages: 993 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 05/10/13 04:28, richard wrote:
>
> Stupid me again.
> forgot the ; at the end of the line above the error.
>
>> echo "</a";
>> ^^^^^^^^^^^^^
and the closing >
>> $aid++;
>> }
>>
>>
>> ?>
--
Ineptocracy
(in-ep-toc’-ra-cy) – a system of government where the least capable to
lead are elected by the least capable of producing, and where the
members of society least likely to sustain themselves or succeed, are
rewarded with goods and services paid for by the confiscated wealth of a
diminishing number of producers.
|
|
|
Re: simple url problem [message #183049 is a reply to message #183048] |
Sat, 05 October 2013 11:43 |
Norman Peelman
Messages: 126 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 10/05/2013 03:55 AM, The Natural Philosopher wrote:
> On 05/10/13 04:28, richard wrote:
>>
>> Stupid me again.
>> forgot the ; at the end of the line above the error.
>>
>>> echo "</a";
>>> ^^^^^^^^^^^^^
> and the closing >
>
>>> $aid++;
>>> }
>>>
>>>
>>> ?>
>
>
Yes, I saw that too, fixed it in my follow up.
--
Norman
Registered Linux user #461062
-Have you been to www.php.net yet?-
|
|
|
Re: simple url problem [message #183050 is a reply to message #183046] |
Sat, 05 October 2013 18:29 |
Denis McMahon
Messages: 634 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On Sat, 05 Oct 2013 01:09:37 -0400, Norman Peelman wrote:
> On 10/04/2013 11:20 PM, richard wrote:
>> [woe is me, for I can't make php produce correct html]
> -or HEREDOC syntax-
> 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).
Mine too, it makes it a lot easier to debug broken html, and I think I
probably don't generate as much broken stuff in the first place with
heredoc, simply because there's less escaping etc needed.
I see Richard still hasn't learned to run his html through the validator,
see where it fails to validate and track that back to his php code before
bringing his broken html issues here though. And these are html issues,
not php ones - his php is outputting the exact strings he's telling it
to, he's just put duff content in those strings.
By the way, just as a fyi everyone, Richard has a clone called Nick in
the python group.
(Am I allowed to say python here?)
--
Denis McMahon, denismfmcmahon(at)gmail(dot)com
|
|
|
Re: simple url problem [message #183053 is a reply to message #183050] |
Sat, 05 October 2013 21:51 |
Tim Streater
Messages: 328 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
In article <l2plpp$2o4$1(at)dont-email(dot)me>,
Denis McMahon <denismfmcmahon(at)gmail(dot)com> wrote:
> On Sat, 05 Oct 2013 01:09:37 -0400, Norman Peelman wrote:
>
>> On 10/04/2013 11:20 PM, richard wrote:
>
>>> [woe is me, for I can't make php produce correct html]
>
>> -or HEREDOC syntax-
>> 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).
>
> Mine too, it makes it a lot easier to debug broken html, and I think I
> probably don't generate as much broken stuff in the first place with
> heredoc, simply because there's less escaping etc needed.
>
> I see Richard still hasn't learned to run his html through the validator,
> see where it fails to validate and track that back to his php code before
> bringing his broken html issues here though. And these are html issues,
> not php ones - his php is outputting the exact strings he's telling it
> to, he's just put duff content in those strings.
>
> By the way, just as a fyi everyone, Richard has a clone called Nick in
> the python group.
>
> (Am I allowed to say python here?)
It would be nice if richard learnt to fix his trivial typos before
coming here.
--
Tim
"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
|
|
|