MyBB Community Forums

Full Version: Portal Layout
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi guys, for the past couple of days i've been trying to achieve the layout that ive attached below.

How can i do such a layout? It is proving quite difficult for me.

The boxes on the right are basically the:

{$welcome}
{$pms}
{$search}
{$stats}
{$whosonline}
{$latestthreads}

boxes. The rest i want to be just various template styled boxes that i can put custom content in. I've tried with 'tr's' and td's but it hasn't been a happy story.

Thanks.
honestly the simplest way without dealing with pro-portal is a few template edits and then editing the core portal file a little

basic portal tempalte layout (you need all the header, footer, etc bits here still)
<table>
	<tr>
		<td>
			{$portal_box_1}
			{$portal_box_2}
		</td>
		<td>
			{$portal_box_3}
			{$portal_box_4}
		</td>
		<td>
			{$portal_box_5}
		</td>
	</tr>
</table>
if the contents of the "boxes" does not already exist as a default content (e.g. portal_lastestthreads) then create new templates called "portal_box_1" (and 2 and 3, etc). and each of those should be it's own table layout
<table>
	<th>
		<td>
			Title of box
		</td>
	</th>
	</tr>
		<td>
			Various box content
		</td>
	</tr>
</table>
For the side by side boxes you want, that shold be a plain two columm table with separate tables in it
<table>
	</tr>
		<td>
			<table>
				<th>
					<td>
						Title of box
					</td>
				</th>
				</tr>
					<td>
						Various box content
					</td>
				</tr>
			</table>
		</td>
		<td>
			<table>
				<th>
					<td>
						Title of box
					</td>
				</th>
				</tr>
					<td>
						Various box content
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>

so once the templates are built edit the portal file and after
$plugins->run_hooks('portal_start');

add for each of the new templates

eval("\$portal_box_1 = \"".$templates->get("portal_box_1")."\";");

this way you can simply edit the various portal_box_1 for the custom content in each directly from the template. of course this only works for static content. dynamic content would need the above templates and then a plugin or more edits to portal file to get the content to be used in the templates (just like normal)
Thanks a lot pavemen, finally made some good ground thanks to your help and it is getting there.

If i may ask a question on a slight tangent, i want to display 2 announcements on the portal, currently like so:

[attachment=27081]

I would prefer the following:

[attachment=27082]

whereby there is one general heading and news articles appear as if clustered under the one heading and in one 'box'.

I tried it myself (as in moving the thead and trow around) but i couldn't see a way of avoid the multiple thead bars for each announcement.

<table cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="thead"><strong>{$icon} <a href="{$mybb->settings['bburl']}/{$announcement['threadlink']}">{$announcement['subject']}</a></strong></td>
</tr>
<tr>
<td class="trow2" align="right">
<span class="smalltext">{$lang->posted_by} {$profilelink}  - {$anndate} {$anntime} {$numcomments}</span>
</td>
</tr>
<tr>
<td class="trow1">
<table border="0" cellpadding="{$theme['tablespace']}" width="100%">
	<tr>
		
		<td class="trow1">
			<p>
				{$message}
			</p>
			{$post['attachments']}
		</td>
	</tr>
	<tr>
		<td align="right" colspan="2" valign="bottom">
			<span class="smalltext">
				<a href="{$mybb->settings['bburl']}/printthread.php?tid={$announcement['tid']}"><img src="{$theme['imgdir']}/printable.gif" alt="{$lang->print_this_item}" title="{$lang->print_this_item}" /></a>&nbsp;<a href="{$mybb->settings['bburl']}/sendthread.php?tid={$announcement['tid']}"><img src="{$theme['imgdir']}/send.gif" alt="{$lang->send_to_friend}" title="{$lang->send_to_friend}" /></a>
			</span>
		</td>
	</tr>
</table>
</td>
</tr>
</table>

<br />


One and only bump.
The portal code does not support that layout so some core and template edits would be required.

You can edit the portal_announcement template to be a single table row with no table open/close and then create a new template portal_announcement_table that has the table open/close tags and the {$announcements} variable in it.

portal_announcements
<tr>
reuse the existing template layout here for the row output less the <table> tags and thead class
</tr>

portal_announcements_table
<table>
{$announcements}
</table>

Then edit the portal file to evaluate the new template

eval("\$announcements = \"".$templates->get("portal_announcement_table")."\";");

just above

$plugins->run_hooks("portal_end");
Doing everything as above, it seems to remove the table. To clarify:

In my main portal template i have

{$portal_announcement_table}

being 'called' where $announcements originally was.

Inside the portal_announcement table is everything except the original table and thead class:

<table cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="thead"><strong>{$icon} <a href="{$mybb->settings['bburl']}/{$announcement['threadlink']}">{$announcement['subject']}</a></strong></td>
</tr>

Leaving:

<tr>
<table cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="thead"><strong>{$icon} <a href="{$mybb->settings['bburl']}/{$announcement['threadlink']}">{$announcement['subject']}</a></strong></td>
</tr>
<tr>
<td class="trow2" align="right">
<span class="smalltext">{$lang->posted_by} {$profilelink}  - {$anndate} {$anntime} {$numcomments}</span>
</td>
</tr>
<tr>
<td class="trow1">
<table border="0" cellpadding="{$theme['tablespace']}" width="100%">
	<tr>
		
		<td class="trow1">
			<p>
				{$message}
			</p>
			{$post['attachments']}
		</td>
	</tr>
	<tr>
		<td align="right" colspan="2" valign="bottom">
			<span class="smalltext">
				<a href="{$mybb->settings['bburl']}/printthread.php?tid={$announcement['tid']}"><img src="{$theme['imgdir']}/printable.gif" alt="{$lang->print_this_item}" title="{$lang->print_this_item}" /></a>&nbsp;<a href="{$mybb->settings['bburl']}/sendthread.php?tid={$announcement['tid']}"><img src="{$theme['imgdir']}/send.gif" alt="{$lang->send_to_friend}" title="{$lang->send_to_friend}" /></a>
			</span>
		</td>
	</tr>
</table>
</td>
</tr>
</tr>


Then inside the new portal_announcement_table is:

<html>
<table>
{$announcements}
</table>
</html>

I appreciate it may seem as you are doing it all here, admittedly i am out of my depth but tryin!

Just to note: I had originally tried to create a thead with the word news in it, and then to try and place the 'rejigged' announcements under that one heading, but failed.
get rid of the <html> parts in teh table template.

then make sure your portal code has been edited as i stated

then go back and put {$announcements} back in the original portal template where you want it to go. this is because I overwrote the original $announcements variable
Done and checked: http://www.berlingoforum.co.uk/portal.php

Appears as it was?

Portal.php

<html>
<head>
<title>{$mybb->settings['bbname']}</title>
{$headerinclude}
</head>
<body>
{$header}
<br />
<table align="center" width="100%">
    <tr valign="top">
        <td width="8%">
			{$portal_rand_showcase}<br />
            
			{$search}       
			</td>
        
        <td>
		{$announcements}


<table align="center" width="80%">
    </tr>
	<td>

        </td>
        <td>
            <table width="25%">
               <td>
                        {$advert}
                    </td>
                </tr>
                    
            </table>
        </td>
        
    </tr>
</table>


		
		</td>
		
		<td width="12%">
		{$welcome}
		{$latestthreads}
        {$dont_speed}
		</td>
    </tr>
</table>
<br />

{$footer}
</body>
</html>

want to send me ACP login details again?

Done.