Templating ... a simple guide

All style (template, theme and imageset) related questions for the new release; advice, feedback here please.
Post Reply
phpN00B
Registered User
Posts: 1
Joined: Fri Feb 11, 2005 2:46 pm

Re: Templating ... a simple guide

Post by phpN00B »

Variables

The basic syntax for simple (non-block) vars remains the same as with 2.0.x. That is variables take the form {X_YYYYY} with the data being assigned from the source. Note that unlike 2.0.x most language strings are not assigned from the source. When a language variable is found {L_YYYYYY} phpBB first looks if an assigned variable exists with that name. If it does, it uses that. If not it looks if an exsting string defined in the language file exists. This should reduce the need to assign loads of new lang vars in Mods.
Sorry I'm pretty noobish to this... but where are those variables defined?

I.E. {L_POST_NEW_TOPIC} refers to /images/lang_english/post.gif IIRC. (Tell me if I'm wrong? :S)

So my question is... in which file can I find that L_POST_NEW_TOPIC refers to /images/lang_english/post.gif ?

Thanks in advance
Graham
Registered User
Posts: 1304
Joined: Tue Mar 19, 2002 7:11 pm
Location: UK

Re: Templating ... a simple guide

Post by Graham »

It doesn't - anything beginning with an L is a language variable (ie text) pulled from language/en/*.php it does not related to an image, unless in the code for a given page it is specified as the alt text for an image
"So Long, and Thanks for All the Fish"

Graham
Eeek, a blog!
Michaelo
Registered User
Posts: 106
Joined: Thu Apr 01, 2004 7:56 am
Location: Dublin

Re: Templating ... a simple guide

Post by Michaelo »

A couple of comments re templates:

Is it me or are templates easier to design and implement in 3.0.0 (2.2.x).

Here is a template for 2.2.x beta. I know 3.0.0 is not available but I don't expect so many changes that the template/style becomes unusable.

Note the portal (kiss-portal ... keep it simple stupid) was built around the index file. Basically I copied the index.php file and recoded it and saved as portal.php. All blocks are html and the new <!-- INCLUDE block_name.html --> is used to include blocks wherever needed...

It's was all so simple ;) Additional code (for the blocks) is stored in one file.

Note the only change to the index file is the inclusion of one line of code.

Portal Page (Thumb)
Image

Portal Full Size Picture
http://homepage.eircom.net/~Michaelo2l/ ... _P_big.jpg

Index Page Picture
http://homepage.eircom.net/~Michaelo2l/ ... BB2B_L.jpg

My intent here (apart from displaying a fully working template / style for 2.2.x) is simply to show how easy the new code including the additional features can be understood to the point that some one like me with limited php skills can achieve some good results.

Comments?
Mods: Forum Icons Enhancement, Kiss Portal Engine
Links:
Kiss Portal Engine (dev site) Stargate Portal (archive site) ...
Styles: Technika
User avatar
stubbers
Registered User
Posts: 406
Joined: Sat Oct 23, 2004 10:36 pm
Location: LoSt
Contact:

Re: Templating ... a simple guide

Post by stubbers »

That looks great, I do have a few questions though. Is there a list of the variables you can use from the files under the include directory, or did you just have to find them yourself. I didn't read this topic before starting work on my own portal and now feel really stupid after creating long and complicated MySQL queries!!

Also a very common HTML/STYLING question, how do you get the barriers around the side of the sections on your page (ie Board Navigation, Online Users, etc) I cannot find an easy neat way of doing this. I know a little CSS but can't really find anything. Thanks!

PSOTFX, I presume that the internally used variables [IF_USER_ONLINE] etc, will not change too much before beta release. The people I am building the portal for don't want to have to wait for too long to get it up and running, so I plan to publish it just a few days after Beta release

Thanks for your time in creating a great board guys!! :D Good job!
Michaelo
Registered User
Posts: 106
Joined: Thu Apr 01, 2004 7:56 am
Location: Dublin

Re: Templating ... a simple guide

Post by Michaelo »

The kiss portal (keep it simple stupid) as seen above doesn’t use anything special. Here is a section from the install file:

BLOCKS Positioning:

Blocks can appear in left, centre or right columns. It is possible to display blocks in one or all columns.
Note: When viewing the index page all blocks are displayed in the left column. This way you have access to them at all times while allowing the posts to use a much space as required without cramping at low resolution.

Block variables stored in Blocks_Table:
block_width, block_position, block_visible, block_active.

Implementation example:

links block

A very simple method was developed to reduce coding and keep it simple.
Sites supply a standard 88x31px image using their url as a file name i.e. http://www.site_name.com.gif" target="_blank
These images are displayed in a random fashion in the links block.
Selecting the images will return the image name less the extension i.e. the URL

Blocks Currently Operational:

Online Users
Search
Links
Amazon
Members Info
Site Statistics

Blocks Not Operational:
recent topics
site survey
downloads
top posters
etc…

NOTES:

language/eu/common.php: Contains all block language vars.
index.php: Added two lines to allow inclusion of blocks.

It’s that simple but I will have to code the more exotic blocks but again keeping it simple :)

Mike

PS pm me when you get your portal up and running... I can help with your template design.
Mods: Forum Icons Enhancement, Kiss Portal Engine
Links:
Kiss Portal Engine (dev site) Stargate Portal (archive site) ...
Styles: Technika
MrTufty
Registered User
Posts: 18
Joined: Sun Jan 23, 2005 11:18 am
Location: UK
Contact:

Re: Templating ... a simple guide

Post by MrTufty »

That looks pretty cool actually. I'll be looking for a portal come the release of Olympus anyway, depending on how long it takes Smartor to release an updated ezPortal.
User avatar
stubbers
Registered User
Posts: 406
Joined: Sat Oct 23, 2004 10:36 pm
Location: LoSt
Contact:

Re: Templating ... a simple guide

Post by stubbers »

Thanks for the help, so some of the blocks don't actually work yet on your portal, or is it just because the system is still in Pre-Beta mode and they aren't actually completed yet. I will probably take you up on the offer of help with the templates
Michaelo
Registered User
Posts: 106
Joined: Thu Apr 01, 2004 7:56 am
Location: Dublin

Re: Templating ... a simple guide

Post by Michaelo »

From the picture you can see which blocks are working. These will require no changes as they are only affected by the current source.

I have just added recent topics but am now concerned with how much the final will change. I note such thinks as polls, announcements are stored in different parts of the database so existing source written to fetch data won't necessarily work. For example I have re-written fetchpost by smartor as the php side of the recent topics block, allowing for changes in the database but who knows how the final database tables may appear and I don't want to redo all the code so... I think I will wait awhile!

The only thing I can be anyway certain of is the existing tables as I guess it would inappropriate and impossible to back peddle.

In the mean time there’s always the styles to play with :)
Mods: Forum Icons Enhancement, Kiss Portal Engine
Links:
Kiss Portal Engine (dev site) Stargate Portal (archive site) ...
Styles: Technika
Graham
Registered User
Posts: 1304
Joined: Tue Mar 19, 2002 7:11 pm
Location: UK

Re: Templating ... a simple guide

Post by Graham »

Guys, can we please leave the MOD discussion to a later date. I realise that you're happy with the templates but we don't have anywhere for MOD discussion at this time.
"So Long, and Thanks for All the Fish"

Graham
Eeek, a blog!
Michaelo
Registered User
Posts: 106
Joined: Thu Apr 01, 2004 7:56 am
Location: Dublin

Re: Templating ... a simple guide

Post by Michaelo »

Sorry got carried away :)
Mods: Forum Icons Enhancement, Kiss Portal Engine
Links:
Kiss Portal Engine (dev site) Stargate Portal (archive site) ...
Styles: Technika
Post Reply