Jump to content


Photo

the use of <br /> or \n


  • This topic is locked This topic is locked
18 replies to this topic

#1 kevdoug

kevdoug
  • Members
  • PipPip
  • Member
  • 23 posts

Posted 20 July 2006 - 04:34 PM

Hi I am trying to display images with the image title with a table but I can't get them in line. I would like the title either above or below the image. All I get at the moment is the title to the side of the image. I have the code below.



        echo "<tr>";
          echo "<td>";
                echo "<a href=". $img ." target='new'><img src=' " . $img . "' height='75' width='100'>";
  echo "</td>";
echo "</tr>";

      I have tried echo "<br  />"; and echo "\n"; here but niether works.

echo "<tr>";
  echo "<td>";
echo OCIResult($stmt,'TITLE');
  echo "</td>";
echo "</tr>";





#2 effigy

effigy
  • Staff Alumni
  • Advanced Member
  • 3,600 posts
  • LocationIL

Posted 20 July 2006 - 04:42 PM

The br will put the break in the browser; \n will put the break in the source. Is a br tag with 2 spaces before the slash valid?
Regexp | Unicode Article | Letter Database
/\A(e)?((1)?ff(?:(?:ig)?y)?|f(?:ig)?)\z/

#3 king arthur

king arthur
  • Members
  • PipPipPip
  • Advanced Member
  • 335 posts
  • LocationUK HQ

Posted 20 July 2006 - 04:43 PM

You haven't closed the anchor tag, e.g. with
</a>
after the img tag.
Sir Isaac Newton said "If I have seen farther, it is by standing on the shoulders of giants". But it is not recorded as to whether he said it before or after he was hit on the head by a falling apple.

#4 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 20 July 2006 - 04:45 PM

This has very little to do with php.

#5 kevdoug

kevdoug
  • Members
  • PipPip
  • Member
  • 23 posts

Posted 20 July 2006 - 04:45 PM

i had to add the 2 spaces or the post took it as a break and would not display it.

#6 treilad

treilad
  • Members
  • PipPipPip
  • Advanced Member
  • 58 posts

Posted 20 July 2006 - 04:46 PM

Worked fine for me, but I echoed it all in one piece.

<?php


echo "<table><tr>
<td><a href=". $img ." target='new'><img src=' " . $img . "' height='75' width='100'><br /><br />
</td>
</tr>
<tr>
<td>
Title
</td>
</tr></table>";

?>




#7 kevdoug

kevdoug
  • Members
  • PipPip
  • Member
  • 23 posts

Posted 20 July 2006 - 04:49 PM

This has very little to do with php.

its with the php code?

#8 treilad

treilad
  • Members
  • PipPipPip
  • Advanced Member
  • 58 posts

Posted 20 July 2006 - 04:50 PM

This has very little to do with php.


He's not hurting anybody.

#9 kevdoug

kevdoug
  • Members
  • PipPip
  • Member
  • 23 posts

Posted 20 July 2006 - 04:54 PM

Worked fine for me, but I echoed it all in one piece.

<?php


echo "<table><tr>
<td><a href=". $img ." target='new'><img src=' " . $img . "' height='75' width='100'><br /><br />
</td>
</tr>
<tr>
<td>
Title
</td>
</tr></table>";

?>




I am echoing the TITLE as a colum from the table.

#10 kevdoug

kevdoug
  • Members
  • PipPip
  • Member
  • 23 posts

Posted 20 July 2006 - 04:57 PM

You haven't closed the anchor tag, e.g. with

</a>
after the img tag.

thanks but closing the img tag has no effect.

#11 treilad

treilad
  • Members
  • PipPipPip
  • Advanced Member
  • 58 posts

Posted 20 July 2006 - 05:02 PM

Yes, I know. But since I don't have that table I just used text. Have you tried mine, substituting your code in?

#12 kevdoug

kevdoug
  • Members
  • PipPip
  • Member
  • 23 posts

Posted 20 July 2006 - 05:21 PM

Yes, I know. But since I don't have that table I just used text. Have you tried mine, substituting your code in?


Yes your code works but when I replace the TITLE for colum TITLE retrieved from the table it goes back to the side.

#13 kevdoug

kevdoug
  • Members
  • PipPip
  • Member
  • 23 posts

Posted 20 July 2006 - 05:33 PM

Yes, I know. But since I don't have that table I just used text. Have you tried mine, substituting your code in?


I've managed to get it to work with the title under the image thanks.
The only prolem now is that they are in a single colum down the page instead of across the page in a row.

#14 HeyRay2

HeyRay2
  • Members
  • PipPipPip
  • Advanced Member
  • 223 posts

Posted 20 July 2006 - 05:38 PM

Can you link the page you are creating so we can see exactly what you are seeing?

#15 kevdoug

kevdoug
  • Members
  • PipPip
  • Member
  • 23 posts

Posted 20 July 2006 - 05:50 PM

Can you link the page you are creating so we can see exactly what you are seeing?


The sites not live yet. Is there a way to insert a screen shot?



#16 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 20 July 2006 - 05:52 PM

Use the img code:
[img]img-url-here[/img]
tags, if you want to place a screen shot

#17 king arthur

king arthur
  • Members
  • PipPipPip
  • Advanced Member
  • 335 posts
  • LocationUK HQ

Posted 20 July 2006 - 05:54 PM

Better to view the source in your browser and cut and paste the code here.
Sir Isaac Newton said "If I have seen farther, it is by standing on the shoulders of giants". But it is not recorded as to whether he said it before or after he was hit on the head by a falling apple.

#18 kevdoug

kevdoug
  • Members
  • PipPip
  • Member
  • 23 posts

Posted 20 July 2006 - 06:29 PM

Use the img code:

[img]img-url-here[/img]
tags, if you want to place a screen shot


The img tag aren't working or at least I can't see the image in preview. but this is what I am getting. The code is also below.

          >:(
        angry

          :(
        sad

          :'(
          cry    This is what I get


  >:(        :(          :'(     
angry      sad        cry    This is what I would like

Any way I hope you get the idea.

while (OCIFetch($stmt))
      {
     
    $img = OCIResult($stmt,'IMAGE');
$titl = OCIResult($stmt,'TITLE');
echo "
<table>
<tr>
<td><a href=". $img ." target='new'><img src=' " . $img . "' height='75' width='100'></a>;
</td>
</tr>

<tr>
<td>
$titl
</td>
</tr>
</table>";


      }


#19 king arthur

king arthur
  • Members
  • PipPipPip
  • Advanced Member
  • 335 posts
  • LocationUK HQ

Posted 20 July 2006 - 07:32 PM

You still aren't closing the <a> tag - IE will take this to mean the entire rest of your table is part of the link.

Try something like


$img = OCIResult($stmt,'IMAGE');
$titl = OCIResult($stmt,'TITLE');

echo "<table><tr><td><a href=" . $img . " target='new'><img src='" . $img . "' height='75' width='100'><br />" . $titl . "</a></td>\n";
echo "<td><a href=" . $img . " target='new'><img src='" . $img . "' height='75' width='100'><br />" . $titl . "</a></td>\n";
echo "<td><a href=" . $img . " target='new'><img src='" . $img . "' height='75' width='100'><br />" . $titl . "</a></td></tr></table>\n";


Sir Isaac Newton said "If I have seen farther, it is by standing on the shoulders of giants". But it is not recorded as to whether he said it before or after he was hit on the head by a falling apple.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users