Understanding themes the A.M.A way

Started by A.M.A, August 23, 2004, 09:04:55 PM

Previous topic - Next topic

A.M.A

PM me your (index.template.php) if you want,  you may just forget a ' or ;
Really sorry .. real life is demanding my full attention .. will be back soon hopefully :)

RCHawaii

#21
EDIT: RESOLVED CHANGE SMILEY:  8)

eFishie

I am trying to make a theme variable reference guide so it's easier to make themes.

SMF themes are way harder than YaBB SE.
--Jon

Abstraction Point Electronic Music Community - We don't bite! Really! I promise!

Check out my newest song: Alive

[Unknown]

Quote from: <? Piranha($fx); ?> on November 04, 2004, 10:47:35 PM
I am trying to make a theme variable reference guide so it's easier to make themes.

SMF themes are way harder than YaBB SE.

http://www.simplemachines.org/community/index.php?topic=16842.0

-[Unknown]

eFishie

--Jon

Abstraction Point Electronic Music Community - We don't bite! Really! I promise!

Check out my newest song: Alive

HoTmetal

Thanks AMA, I've been looking for something like this. Now if you have another one explaining how to package it so other may use it , I'll be in bisiness

A.M.A

Really sorry .. real life is demanding my full attention .. will be back soon hopefully :)

osckar

Hi:

reading this brief tutorial on how to add things to (or modify) index.template.php, this is my case (I guess it could be useful for future reference):

I have already splitted my template like this:

<-------- header ----------->
<--left col--> <---forum--->
<--------- footer ----------->

Everything is ok, but, I would like to move some parts  into a 2 column table, below my "header", for the design to look this way:

<--------------------- header --------------------->
<---------- col1---------><---------col2---------->
<--left col--> <-------------forum---------------->
<--------------------- footer ----------------------->

in the "col1" I'd like to put the login box (user info table) and search, key stats table and news and in col2 (300 px width), I'd like to put some dynamic content (php code). I will not use the right logo.

I know all this means moving and editing code and maybe adding some new tags, etc but Im stuck with this. Im new to SMF templates and prefer to have someone to guide me.

Thank you for your help.


A.M.A

The default template already has two columns for the header. The first row is used for displaying the forum's name and logo:
<td colspan="2" valign="bottom" style="padding: 5px; white-space: nowrap;">';

// This part is the logo and forum name.  You should be able to change this to whatever you want...

the second row is divided into two columns (tds) the right one is for the user info box and search field:
<td valign="top">
<div class="headertitles" style="margin-right: 5px; position: relative;"><img src="', $settings['images_url'], '/blank.gif" height="12" alt="" /></div>

while the second one is used for displaying the key stats and news:
<td width="262" style="padding-left: 5px;" valign="top">';

// Show a random news item? (or you could pick one from news_lines...)

and here are the options you have:

1. Simply add another column to have a total of three, the third one will be used for your own content .. to do that you need to first adjust the columns span in the first row by replacing colspan="2" with colspan="3" then you have to add the third column just right after the second one ends:
echo '
</td>
</tr>
</table>
to be something like this:
echo '
</td>
<td width="300" valign="top">My New Content</td>
</tr>
</table>


2. Move the contents from the second column to the first one and use the second empty now column for your content.

3 Wipe out the contents from the second column and use you own instead.
Really sorry .. real life is demanding my full attention .. will be back soon hopefully :)

Dannii

#29
I've found it doesn't always work so well doing that, and that its best to use two tables. here's something i've done like that:

<body>
<table width=100% height=100% cellspacing=0 cellpadding=0>
<tr><td id="top" colspan=2><table width=100% height=100% cellspacing=0 cellpadding=0>
<tr><td id="tl"></td><td><div id="title">Home</div></td></tr></table></td></tr>
<tr><td id="bot"><table width=100% height=100% cellspacing=0 cellpadding=0>
<td id="left" valign=top><img src="./l1a.jpg" /><img src="./l2a.jpg" /><img src="./l3a.jpg" /></td><td valign=top>
bodytexthere
</td></tr></table></td></tr></table>
</body>
"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

osckar

Ok, I have setup the tables, columns, and I have added a new php include with my own content.

I would like to move the "key stats" to my left col just below my left_menu.php include.

I have this code but it returns me a parse error (maybe I missed a tag or something) :

// The main content should go here.  A table is used because IE 6 just can't handle a div.
   echo '
   <table width="770" cellpadding="0" cellspacing="0" border="0" align="center"><tr>
      <td width="130" valign="top">';

include('left_menu.php');

   echo '
               <div class="headertitles" style="width: 130px;"><img src="', $settings['images_url'], '/blank.gif" height="12" alt="" /></div>
               <div class="headerbodies" style="width: 130px; position: relative; background-image: url(', $settings['images_url'], '/box_bg.gif);">
                  <img src="', $settings['images_url'], '/', $context['user']['language'], '/keystats.gif" style="position: absolute; left: -1px; top: -16px;" alt="" />
                  <div style="height: 35px; padding: 5px;" class="smalltext">
                     <b>', $modSettings['totalMessages'], '</b> ', $txt[95], ' ', $txt['smf88'], ' <b>', $modSettings['totalTopics'], '</b> ', $txt[64], ' ', $txt[525], ' <b>', $modSettings['memberCount'], '</b> ', $txt[19], '<br />
                     ', $txt[656], ': <b> <a href="', $scripturl, '?action=profile;u=', $modSettings['latestMember'], '">', $modSettings['latestRealName'], '</a></b>
                  </div>
               </div></td>';


One more question regarding this: Can I use the keystats or another section twice in the same template? Or will this cause a parse error?

Thank you

A.M.A

Your codes look fine .. maybe you forget to end an echo before using your code.
Yes, you can use another instance of the key stats.
Really sorry .. real life is demanding my full attention .. will be back soon hopefully :)

crammed

I'm looking for a simple way to add my site's menu somewhere into the design of the forum, probably just above the menu buttons.  Is there a really simple way to do this?

My forum is at hxxp:www.gvgo.ca/mb/ [nonactive] and I'd eventually like to integrate it into the overall design so that it will look something like out photo gallery at hxxp:www.gvgo.ca/gallery/ [nonactive] .  But, for now, I just want to get the menu onto the forum so that users can get back to the rest of the site.

I am trying to read through some of the help information here.  But, I am not very familiar with PHP.  So, I am having some trouble interpreting some of the instructions.  Any help would be much appreciated.

itsme

Hi,

I have been playing around quite a bit, and have managed, on a copy of default theme, todo some stuff without getting the template parse error.  Finally. 

What I am trying to do is this...

at the top full width, my logo,
next, full width, the button menu.

next, two columns

column one, 20%...the user info box including avatar at top.
some links
maybe some hot topics...like on my home page, I use ssi for last posts on a certain board.

column two...80%...forum

bottom...full width...footer stuff...copyrights etc.

I get close, and then hit the parse errors.

Dave

1MileCrash

Im trying to add content into the second column i made (the 20% one) And i am running into problems. All of the content is centered vertically, and i cant find out why.
The only thing php can't do is tell you how much milk is left in the fridge.



bloc

If its a table..how about setting the <td> with valign="top"? (If its a <div> use style="vertical-align: top;")

1MileCrash

word. I had a dumb moment. I realized that it was in a table and valigned it, It still looks like poo aligned all the way at the top though. Ill probabally insert a blank image in it to bring the content down. I tried inserting like, 5 <p>'s, but that didnt work...
The only thing php can't do is tell you how much milk is left in the fridge.



bloc

Try style="padding-top: 30px;" or whatever...on that <td>. ;)

1MileCrash

thanks bloc.

Okay, now, i need help. I want the menu, the newsbox, and key stats all in my column. For the menu, at first i was simply going to use "A HREF="whatever.php>whatever</A>, but then the link to the admin panel would show for everyone, i know they still couldnt get in because they had to provide a password, but it wouldnt be as neat.

Can somebody show me what i have to put between the column tags? And once i am successful, how do i remove newsbox, menu, and key stats from their current location?

Do i need any php for this? Because all the php i know is in the following code box-

The only thing php can't do is tell you how much milk is left in the fridge.



bloc

For starters, to show the link to admin panel..you would do something like this:
<td> ' , $context['user']['is_admin'] ? '<a href="">admin</a>' : '' , '</td>.

To break it down a bit...
When you use a apostrophe you end an echo statement , and when you use a comma AFTER the apostrophe, it means to check or execute something in php.

Here we check. The checking is just "check if the variable $context['user']['is_admin'] is set to be TRUE". It just does that by placing the variable alone like that. Then WHAT shall we do if its true? The question mark signals "here it starts", and you just enclose what should be rendered(HTML again) in apostrophes again.

If its NOT true, you render nothing -- the colon is a marker to difference between the two, and the 2 single apostrophes means render "nothing". So comes a comma again to end this checking business and a new apostrophe to carry on the original echo statement.

If you see the logic in this, then you are on a good way of understanding php, because the templates is full of these little checks. And it makes it possible to show anything, just by checking variables for what a member are, which board, even what time it is!. ;D

If you look at index.template.php and find template_menu() you will see how the original menu is made exactly like I described - only shows the links/buttons the visitor are allowed to see. It checks if calendar is ON, if you are a admin etc.

Advertisement: