Jump to content

How to display objects in a row


LexHammer

Recommended Posts

I have 7 codes that i want to display in a row one next to another.

The first is {$ads->ads_display('1')}, the second {$ads->ads_display('2')} and so on...

They appear one under the other. I want them to appear like this: @ @ @ @ @ @

 

Can you pls give me the code that i need for that...

Link to comment
https://forums.phpfreaks.com/topic/184627-how-to-display-objects-in-a-row/
Share on other sites

I assume you mean for SMARTY? Then you pretty much have the code..

 

{$ads->ads_display('1')} {$ads->ads_display('2')} {$ads->ads_display('3')} {$ads->ads_display('4')} {$ads->ads_display('5')} {$ads->ads_display('6')} {$ads->ads_display('7')}

This is the code for the ads_display. Its jut showing small picture with redirect url

 

<div>
<div Xstyle='float:left'>
<a href='http://www.****.com/***/'>
<img src=http://www.****.com/./uploads_user/1000/2/0_4230.jpg width=50 border=0>
</a>
</div>
<div></div>
</div>

Well by default DIVs are block elements that will appear on a new line. Look at your code..

 

<div>
<div Xstyle='float:left'>
<a href='http://www.****.com/***/'>
<img src=http://www.****.com/./uploads_user/1000/2/0_4230.jpg width=50 border=0>
</a>
</div>
<div></div>
</div>

 

They're each obviously going to appear on a new line. I think you were on the right track before with the "float:left"; though I'm not sure why there's an "X" before the style attribute? Because there's a parent DIV to the floated DIV though, you're still going to end up with each block on a new line. Float the most parent DIV of each block of code basically.

 

<div style="float: left;">
    <a href='http://www.****.com/***/'>
        <img src=http://www.****.com/./uploads_user/1000/2/0_4230.jpg width=50 border=0>
    </a>
</div>

 

Give that a try, stripped out some of the useless code. You'll probably need to use "clear: both" after.

 

Just to add though, is there any need for them to be wrapped within a div?

I used your code, but no change at all, they are still in a column Just to tell you, that i have very low php skills so dont ask me to do anything:) I just can copy paste the code you give me and adjust it with my content...

What about if the ads_display codes are inserted itno in a table?

Heh noo, don't use tables. As I said before is there any special reason why these images need to be wrapped in a div? Styling purposes or anything? If not just remove it so you just have the image:

 

<a href='http://www.****.com/***/'>
    <img src=http://www.****.com/./uploads_user/1000/2/0_4230.jpg width=50 border=0>
</a>

I dont know what else to show you... this is all i got.  The div was because of an option that can have text comment for the ad, but no need of that.

 

Here is the row code without the div.

 

<a href='[userprofile]'>

<img src=[userphoto] width=[userphotowidth] border=0>

</a>

 

That will display the user's photo on the top of the page and when somebody click on it, he will be redirected to the profile.

 

I think that making the pictures in a table with 10 pictures/row will be good if there is no other way now...

Archived

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

×
×
  • Create New...

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.