Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 288
  • Last Modified:

How to print IMG tag... xhtml sytlee

Hello all EEs... I have a PHP quickie.

I am trying to dynamically write some IMG stars within a PHP for loop,
however they need to be XHTML compliant - WITH a closing slash, like so:

$star="<img src='images/star.gif' height='12px' width='12px' alt='someALT' />";
(... the above will not output the closing slash)

How can I ensure that the backslash is present within the generated IMG tags?

Thanks muchly as time is of the essence (& my eyes hurt)

--ARCglide
0
ARCglide
Asked:
ARCglide
  • 2
  • 2
1 Solution
 
virmaiorCommented:
the closing slash shows when i echo that line in php (php 5.0.4)

$star="<img src='images/star.gif' height='12px' width='12px' alt='someALT' />";
echo $star;

and it's there.  are you using HTMLtidy or something like it to redo your tags?
0
 
ARCglideAuthor Commented:
I am using Firefox v1.0.3... and viewing: http://arcdev.co.uk/stars/startest.php

When I select some of the stars (eg. row5) - right click - 'view selected source' all the IMG and BR closing slashes are omitted!
However, when viewing full-page-source they are all present and correct.

Cool - all is proved good... thanX

0
 
virmaiorCommented:
I think that's a property of the parser in FireFox.
0
 
ARCglideAuthor Commented:
Not a huge issue - but seriously annoying when at the end of a bank-holiday weekend 'code-burn' the little things seemed to be going screwy.

You we're right - so you get the points!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now