Jump to content

extremely simple div positioning question


swiss73

Recommended Posts

hello there.

The FIRST post in topics on the php freaks forums shows a google ad. I tried to do something similar to this on my forums using the following div....

[code]<div class="titlebg2" style="padding: 20px; margin-left: 20px; float:right">[/code]


the content of the div still pushed the whole post below its level ......

what am I missing ? I would like to float this div content to the right...... as the google ad on php freaks first post....



Link to comment
Share on other sites

If you are using SMF,. then the following should do:
[code]<div style="margin-left: 20px;float:right">Google Ads javasript here</div>[/code]

You place that code directly after the <div class="post"> tag and it should display the adds to the right of the text. ALso the text should warp it self around the ad too, however code/quote blocks do tend to flow over the top the ads. This is a z-index issue i think.
Link to comment
Share on other sites

[quote author=wildteen88 link=topic=117160.msg478566#msg478566 date=1165255502]
If you are using SMF,. then the following should do:
[code]<div style="margin-left: 20px;float:right">Google Ads javasript here</div>[/code]

You place that code directly after the <div class="post"> tag and it should display the adds to the right of the text. ALso the text should warp it self around the ad too, however code/quote blocks do tend to flow over the top the ads. This is a z-index issue i think.
[/quote]


I apologize to disturb you with this, but I am really lost.

here is the code in the display.template.php

[code] // Show the post itself, finally!
echo '
</td>
</tr></table>
<hr width="100%" size="1" class="hrcolor" />';

echo '

<div class="post"', $message['can_modify'] ? ' id="msg_' . $message['id'] . '"' : '', '>', $message['body'], '</div>', $message['can_modify'] ? '
<img src="' . $settings['images_url'] . '/icons/modify_inline.gif" alt="" align="right" id="modify_button_' . $message['id'] . '" style="cursor: pointer; display: none;" onclick="modify_msg(\'' . $message['id'] . '\', \'' . $context['session_id'] . '\')" />' : '', '


</td>
</tr>';

// Now for the attachments, signature, ip logged, etc...
[/code]


what I want to insert is in a pure html file, as such

include("html.inc.php");

please let me know how to modify the code without breaking the template.

Link to comment
Share on other sites

Yes you can. You'll wnat to chnage this code:
[code]/ Show the post itself, finally!
echo '
</td>
</tr></table>
<hr width="100%" size="1" class="hrcolor" />';

echo '

<div class="post"', $message['can_modify'] ? ' id="msg_' . $message['id'] . '"' : '', '>', $message['body'], '</div>', $message['can_modify'] ? '
<img src="' . $settings['images_url'] . '/icons/modify_inline.gif" alt="" align="right" id="modify_button_' . $message['id'] . '" style="cursor: pointer; display: none;" onclick="modify_msg(\'' . $message['id'] . '\', \'' . $context['session_id'] . '\')" />' : '', '


</td>
</tr>';

// Now for the attachments, signature, ip logged, etc..[/code]

to this:
[code] // Show the post itself, finally!
echo '
</td>
</tr></table>
<hr width="100%" size="1" class="hrcolor" />
<div class="post"', $message['can_modify'] ? ' id="msg_' . $message['id'] . '"' : '', '>';

                            include('./Themes/default/html.inc.php');

                            echo $message['body'], '</div>', $message['can_modify'] ? '
<img src="' . $settings['images_url'] . '/icons/modify_inline.gif" alt="" align="right" id="modify_button_' . $message['id'] . '" style="cursor: pointer; display: none;" onclick="modify_msg(\'' . $message['id'] . '\', \'' . $context['session_id'] . '\')" />' : '' , '
</td>
</tr>';

// Now for the attachments, signature, ip logged, etc...[/code]
Now you'll want to create the html.inc.php file in {SMF_ROOT_FOLDER}/Themes/default now edit that file and add the relevant html to that file. It should now include that file for ever post in the thread.

If you want it only show for the first post in the thread then you'll want change this:
[code]<div class="post"', $message['can_modify'] ? ' id="msg_' . $message['id'] . '"' : '', '>';

                            include('./Themes/default/html.inc.php');

                            echo $message['body'], '</div>', $message['can_modify'] ? '[/code]
To the following:
[code]<div class="post"', $message['can_modify'] ? ' id="msg_' . $message['id'] . '"' : '', '>';

                            if(!isset($fPOST) || $fPOST != true)
                            {
                                include('./Themes/default/html.inc.php');

                                $fPOST = true;
                            }

                            echo $message['body'], '</div>', $message['can_modify'] ? '[/code]
Link to comment
Share on other sites

No problem. I am getting used how SMF works now and I am able to hack it into shape in a couple of mins.

If you have anymore questions/problems with this or SMF Templates then please post in the Third Party PHP Scripts forum. I should of told you this earlier but I let you off.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.