[thelist] PHP to insert press Releases into a detail page

Jono jono at charlestonwebsolutions.com
Sat Sep 24 08:31:13 CDT 2005


On 9/24/05 4:04 AM, "Kasimir K" <evolt at kasimir-k.fi> wrote:

>> I believe it does - I see the echo "<a href=...> - but I just wanted to
>> make sure that was the case.
> 
> ... The 'for' loops through all articles, and 'echo' outputs
> a link for each to the browser. ... a neater option would be to use <li>, and
it's easy to include styles as well:
> 
> <ul>
> <?php
> for ($i = 0; $i < count($articles); $i++){
>      echo "<li class='artList'><a href='pr_detail.php?article="
>        . $i . "'>" . $articles[$i]['title'] . "</a></li>";
> }
> ?>
> </ul>
> 
> Note also the use on single quotes for class and href attributes - this
> is because we use double quotes to delimit the string we output with echo.
> 
> .k

That sounds perfect.  I am going to go ahead and give the list a shot.  I
recently put a contact form on my (yet to be released) Web site using a PHP
include, and I ran into the double quote/single quote issue when trying to
add class and ID hooks to the form elements.  I soon figured out - thanks to
syntax coloring in TextWrangler - that I needed to use single quotes
instead.  I might be back for a bit of help on this one, but I does appear
to be a easy set up.

It's a good way to break into PHP.  Small steps at a time.

Thanks again.





More information about the thelist mailing list