Jump to content

Archived

This topic is now archived and is closed to further replies.

kevdoug

the use of <br /> or \n

Recommended Posts

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.



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

      I have tried [color=red]echo "<br  />";[/color] and [color=red]echo "\n";[/color] here but niether works.

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


Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
This has very little to do with php.

Share this post


Link to post
Share on other sites
i had to add the 2 spaces or the post took it as a break and would not display it.

Share this post


Link to post
Share on other sites
Worked fine for me, but I echoed it all in one piece.

[quote]<?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>";

?>[/quote]

Share this post


Link to post
Share on other sites
[quote author=thorpe link=topic=101273.msg400564#msg400564 date=1153413900]
This has very little to do with php.
[/quote]
its with the php code?

Share this post


Link to post
Share on other sites
[quote author=thorpe link=topic=101273.msg400564#msg400564 date=1153413900]
This has very little to do with php.
[/quote]

He's not hurting anybody.

Share this post


Link to post
Share on other sites
[quote author=treilad link=topic=101273.msg400568#msg400568 date=1153414010]
Worked fine for me, but I echoed it all in one piece.

[quote]<?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>";

?>[/quote]


[/quote]

I am echoing the [color=red]TITLE[/color] as a colum from the table.

Share this post


Link to post
Share on other sites
[quote author=king arthur link=topic=101273.msg400563#msg400563 date=1153413806]
You haven't closed the anchor tag, e.g. with
[code]
</a>
[/code]
after the img tag.
[/quote]
thanks but closing the img tag has no effect.

Share this post


Link to post
Share on other sites
Yes, I know. But since I don't have that table I just used text. Have you tried mine, substituting your code in?

Share this post


Link to post
Share on other sites
[quote author=treilad link=topic=101273.msg400585#msg400585 date=1153414953]
Yes, I know. But since I don't have that table I just used text. Have you tried mine, substituting your code in?
[/quote]

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

Share this post


Link to post
Share on other sites
[quote author=treilad link=topic=101273.msg400585#msg400585 date=1153414953]
Yes, I know. But since I don't have that table I just used text. Have you tried mine, substituting your code in?
[/quote]

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.

Share this post


Link to post
Share on other sites
Can you link the page you are creating so we can see exactly what you are seeing?

Share this post


Link to post
Share on other sites
[quote author=HeyRay2 link=topic=101273.msg400615#msg400615 date=1153417113]
Can you link the page you are creating so we can see exactly what you are seeing?
[/quote]

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

Share this post


Link to post
Share on other sites
Use the img code:
[code][img]img-url-here[/img][/code] tags, if you want to place a screen shot

Share this post


Link to post
Share on other sites
[quote author=wildteen88 link=topic=101273.msg400629#msg400629 date=1153417971]
Use the img code:
[code][img]img-url-here[/img][/code] tags, if you want to place a screen shot
[/quote]

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.

[color=red] 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>";


      }[/color]

Share this post


Link to post
Share on other sites
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

[code]

$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";

[/code]

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.