Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Programmatical unordered lists - PHP

LEGEND ,
Feb 13, 2007 Feb 13, 2007

Copy link to clipboard

Copied

I have this code to write a recordset into adjacent sets of unordered lists,
each containing 5 list elements -

<ul>
<?php $i=0; do { ?>
<li><a href="p7hg_img_1/fullsize/<?php echo
$row_Recordset1['imgsFilename']; ?>_fs.jpg"><img
src="p7hg_img_1/thumbs/<?php echo $row_Recordset1['imgsFilename'];
?>_tmb.jpg" alt="Gallery: Image" title="" width="100" height="67"></a>
<div><?php echo $row_Recordset1['imgsCaption'];
?></div>
</li>
<?php $i++; if ($i==5) { $i=0; echo '</ul><ul>'; } ?>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</ul>

The problem comes when the looper terminates. I am left with a spare
<ul></ul> pair. How can I manage this?

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================



TOPICS
Server side applications

Views

581
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 13, 2007 Feb 13, 2007

Copy link to clipboard

Copied

On Tue, 13 Feb 2007 20:17:58 -0500, "Murray *ACE*"
<forums@HAHAgreat-web-sights.com> wrote:

>The problem comes when the looper terminates. I am left with a spare
><ul></ul> pair. How can I manage this?


Try something like this:

<?php
$tmplt='<li><a href="p7hg_img_1/fullsize/%s_fs.jpg">'.
'<img src="p7hg_img_1/thumbs/%s_tmb.jpg" alt="Gallery: '.
'Image" title="" width="100" height="67"></a>'.
'<div>%s</div></li>'."\n";
$i=0; do {
if($i%5==0)
print "<ul>\n";
printf($tmplt,$row_Recordset1['imgsFilename'],
$row_Recordset1['imgsFilename'],$row_Recordset1['imgsCaption']);
$i++;
if($i%5==0)
print "</ul>\n";
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
if($i%5!=0)
print "</ul>\n";
?>

Gary

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 14, 2007 Feb 14, 2007

Copy link to clipboard

Copied

That looks great. I'll give it a try!

Thanks a million.

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"Gary White" <gary@apptools.com> wrote in message
news:ca95t25aaso285pvo9qjai8lmo63hg42i3@4ax.com...
> On Tue, 13 Feb 2007 20:17:58 -0500, "Murray *ACE*"
> <forums@HAHAgreat-web-sights.com> wrote:
>
>>The problem comes when the looper terminates. I am left with a spare
>><ul></ul> pair. How can I manage this?
>
>
> Try something like this:
>
> <?php
> $tmplt='<li><a href="p7hg_img_1/fullsize/%s_fs.jpg">'.
> '<img src="p7hg_img_1/thumbs/%s_tmb.jpg" alt="Gallery: '.
> 'Image" title="" width="100" height="67"></a>'.
> '<div>%s</div></li>'."\n";
> $i=0; do {
> if($i%5==0)
> print "<ul>\n";
> printf($tmplt,$row_Recordset1['imgsFilename'],
> $row_Recordset1['imgsFilename'],$row_Recordset1['imgsCaption']);
> $i++;
> if($i%5==0)
> print "</ul>\n";
> } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
> if($i%5!=0)
> print "</ul>\n";
> ?>
>
> Gary


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 14, 2007 Feb 14, 2007

Copy link to clipboard

Copied

Works just great.

http://www.wildimages.biz/wi_gallery-wildlifeTEST.php

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
news:eqv1ql$7sc$1@forums.macromedia.com...
> That looks great. I'll give it a try!
>
> Thanks a million.
>
> --
> Murray --- ICQ 71997575
> Adobe Community Expert
> (If you *MUST* email me, don't LAUGH when you do so!)
> ==================
> http://www.dreamweavermx-templates.com - Template Triage!
> http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
> http://www.dwfaq.com - DW FAQs, Tutorials & Resources
> http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
> ==================
>
>
> "Gary White" <gary@apptools.com> wrote in message
> news:ca95t25aaso285pvo9qjai8lmo63hg42i3@4ax.com...
>> On Tue, 13 Feb 2007 20:17:58 -0500, "Murray *ACE*"
>> <forums@HAHAgreat-web-sights.com> wrote:
>>
>>>The problem comes when the looper terminates. I am left with a spare
>>><ul></ul> pair. How can I manage this?
>>
>>
>> Try something like this:
>>
>> <?php
>> $tmplt='<li><a href="p7hg_img_1/fullsize/%s_fs.jpg">'.
>> '<img src="p7hg_img_1/thumbs/%s_tmb.jpg" alt="Gallery: '.
>> 'Image" title="" width="100" height="67"></a>'.
>> '<div>%s</div></li>'."\n";
>> $i=0; do {
>> if($i%5==0)
>> print "<ul>\n";
>> printf($tmplt,$row_Recordset1['imgsFilename'],
>> $row_Recordset1['imgsFilename'],$row_Recordset1['imgsCaption']);
>> $i++;
>> if($i%5==0)
>> print "</ul>\n";
>> } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
>> if($i%5!=0)
>> print "</ul>\n";
>> ?>
>>
>> Gary
>
>


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 14, 2007 Feb 14, 2007

Copy link to clipboard

Copied

Murray *ACE* wrote:

> Works just great.
>
> http://www.wildimages.biz/wi_gallery-wildlifeTEST.php
>
Have you tried it in FF Mac?
If you select a "thumbnail panel", the thumbnails do not appear in the
panel correctly.
In Safari there are only two panels, as opposed to 10 in FF (but they work).
Mozilla Mac is same as FF
Mick

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 14, 2007 Feb 14, 2007

Copy link to clipboard

Copied

Something dreadfully wrong there!

Standby....

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"Mick White" <himselfBOGUS@mickweb.com> wrote in message
news:eqv64q$clt$1@forums.macromedia.com...
> Murray *ACE* wrote:
>
>> Works just great.
>>
>> http://www.wildimages.biz/wi_gallery-wildlifeTEST.php
>>
> Have you tried it in FF Mac?
> If you select a "thumbnail panel", the thumbnails do not appear in the
> panel correctly.
> In Safari there are only two panels, as opposed to 10 in FF (but they
> work).
> Mozilla Mac is same as FF
> Mick


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 14, 2007 Feb 14, 2007

Copy link to clipboard

Copied

Ahh - how curious indeed.

Look at the source from FF. I had commented out a huge part of the
'hardwired' image code from this page -

http://www.wildimages.biz/wi_gallery-wildlife.php

and replaced it with the PHP looper which should only pull 10 images from
the database. You can see the opening comment tag just below the markup for
those 10 images. But for some reason, FF is losing the comment somewhere in
the middle of a line just after the Clarks Grebe with yawning chick image!
I wonder why?

Anyhow, it's academic as I will remove all of that code on the final
page.....

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"Mick White" <himselfBOGUS@mickweb.com> wrote in message
news:eqv64q$clt$1@forums.macromedia.com...
> Murray *ACE* wrote:
>
>> Works just great.
>>
>> http://www.wildimages.biz/wi_gallery-wildlifeTEST.php
>>
> Have you tried it in FF Mac?
> If you select a "thumbnail panel", the thumbnails do not appear in the
> panel correctly.
> In Safari there are only two panels, as opposed to 10 in FF (but they
> work).
> Mozilla Mac is same as FF
> Mick


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 14, 2007 Feb 14, 2007

Copy link to clipboard

Copied

On Wed, 14 Feb 2007 09:25:29 -0500, Mick White
<himselfBOGUS@mickweb.com> wrote:

>If you select a "thumbnail panel", the thumbnails do not appear in the
>panel correctly.
>In Safari there are only two panels, as opposed to 10 in FF (but they work).
>Mozilla Mac is same as FF


The first two rows of thumbs look to be generated by the PHP code. After
those two, there is an opening comment that is never closed and is
followed by some other <ul>'s that are not generated by the PHP:

</ul>
<!-- <ul>

When FF get's to this:

Clarks-Grebe-with-yawning-chick-rider-Photoshopped-UT-HS00480--01811C_fs.jpg">

It sees the adjacent hyphens and decides to close the comment after the
closing angle bracket for that image.

Gary

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 14, 2007 Feb 14, 2007

Copy link to clipboard

Copied

Actually, the opening comment is closed, but WAY down the page.

So - it's the two adjacent hyphens that is tricking FF? How ... unusual.

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"Gary White" <gary@apptools.com> wrote in message
news:s0a6t21e3m7aa18hjv99d3sm1bc4rmbkoo@4ax.com...
> On Wed, 14 Feb 2007 09:25:29 -0500, Mick White
> <himselfBOGUS@mickweb.com> wrote:
>
>>If you select a "thumbnail panel", the thumbnails do not appear in the
>>panel correctly.
>>In Safari there are only two panels, as opposed to 10 in FF (but they
>>work).
>>Mozilla Mac is same as FF
>
>
> The first two rows of thumbs look to be generated by the PHP code. After
> those two, there is an opening comment that is never closed and is
> followed by some other <ul>'s that are not generated by the PHP:
>
> </ul>
> <!-- <ul>
>
> When FF get's to this:
>
> Clarks-Grebe-with-yawning-chick-rider-Photoshopped-UT-HS00480--01811C_fs.jpg">
>
> It sees the adjacent hyphens and decides to close the comment after the
> closing angle bracket for that image.
>
> Gary


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 14, 2007 Feb 14, 2007

Copy link to clipboard

Copied

On Wed, 14 Feb 2007 10:48:08 -0500, "Murray *ACE*"
<forums@HAHAgreat-web-sights.com> wrote:

>Actually, the opening comment is closed, but WAY down the page.
>
>So - it's the two adjacent hyphens that is tricking FF? How ... unusual.


Not really. See http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.4

In particular, note:

<quote>White space is not permitted between the markup declaration open
delimiter("<!") and the comment open delimiter ("--"), but is permitted
between the comment close delimiter ("--") and the markup declaration
close delimiter (">"). A common error is to include a string of hyphens
("---") within a comment. Authors should avoid putting two or more
adjacent hyphens inside comments.</quote>

I guess, technically, the content between -- and > is not really white
space, the -- *is* still seen as the comment close delimiter. At any
rate, if you remove the commented text, or rename the file with the
double hyphen, it should solve the issue.

Gary

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 14, 2007 Feb 14, 2007

Copy link to clipboard

Copied

.oO(Murray *ACE*)

>Actually, the opening comment is closed, but WAY down the page.
>
>So - it's the two adjacent hyphens that is tricking FF? How ... unusual.

Unusual maybe, but correct. See

3.2.4 Comments
http://www.w3.org/TR/html401/intro/sgmltut.html#h-3.2.4

| White space is not permitted between the markup declaration open
| delimiter("<!") and the comment open delimiter ("--"), but is
| permitted between the comment close delimiter ("--") and the markup
| declaration close delimiter (">"). A common error is to include a
| string of hyphens ("---") within a comment. Authors should avoid
| putting two or more adjacent hyphens inside comments.

Micha

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 14, 2007 Feb 14, 2007

Copy link to clipboard

Copied

I do recall that now that you mention it. THanks for the reminder!

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"Gary White" <gary@apptools.com> wrote in message
news:h6h6t2dmmcoqc3ui8ftimvj0j5kvbispd2@4ax.com...
> On Wed, 14 Feb 2007 10:48:08 -0500, "Murray *ACE*"
> <forums@HAHAgreat-web-sights.com> wrote:
>
>>Actually, the opening comment is closed, but WAY down the page.
>>
>>So - it's the two adjacent hyphens that is tricking FF? How ... unusual.
>
>
> Not really. See http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.4
>
> In particular, note:
>
> <quote>White space is not permitted between the markup declaration open
> delimiter("<!") and the comment open delimiter ("--"), but is permitted
> between the comment close delimiter ("--") and the markup declaration
> close delimiter (">"). A common error is to include a string of hyphens
> ("---") within a comment. Authors should avoid putting two or more
> adjacent hyphens inside comments.</quote>
>
> I guess, technically, the content between -- and > is not really white
> space, the -- *is* still seen as the comment close delimiter. At any
> rate, if you remove the commented text, or rename the file with the
> double hyphen, it should solve the issue.
>
> Gary


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 14, 2007 Feb 14, 2007

Copy link to clipboard

Copied

LATEST
On Wed, 14 Feb 2007 14:39:24 -0500, "Murray *ACE*"
<forums@HAHAgreat-web-sights.com> wrote:

>I do recall that now that you mention it. THanks for the reminder!


No problem. You're welcome.

Gary

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines