(Vol. 1, _header.html) Learning the template engine.

PhyraxDesigns posted 4th of March 2008 in Community Voice. 4 comments.
    For ages I've browsed the forums and Google to find out how to make my own custom templates for Dolphin.  As most of you know, there is no real detailed description of the values and how the template engine is breaking down things.  So I've started this little blog to not only help myself understand the template engine but to help others also.

NOTE: before you ever think about customizing a file, always have a backup first.  Once saved, you're royally screwed unless you have a nice program with a good Ctrl+Z cache.

    The most obvious starting point is to open the template files and go from there, if you're using Adobe Dreamweaver as I am, this makes it really easy to find out where things are.  You see, Dreamweaver comes with a great search engine which allows you to search inside of a folder, current document, open document, selected text, and more.  On top of that, it allows you to search inside of the source code, text, and for specific tags.  So this really helps.  Anyhow, enough of Dreamweaver, it's time to find some stuff!  So I obviously start with the most important file.  _header.html

    In the templates directory you'll notice two folders /base and /tmpl_uni where the latter is the actual template file.  Not much in the /base directory other than some CSS, which I may look at later, images and scripts, which I will definitely need to look at I believe.  There is also a _header and _footer file which isn't important right now. 

    Now in the _header.html file I noticed that it was including what I assume to be the header file from the /base directory.  So I'm assuming the following is required in the header files inside the /tmpl_uni directory or any template directory for that matter: __includebase _header.html

    For some reason, all the template variables begin and end with dual underscores.  If you're familiar with phpBB templates you'll remember they were delegated by brackets {}.  If you haven't looked at the _header.html file yet, here's the variables inside the "topestMenu" div wrapper:
  • __TOP_Links__
  • __TOP_News__
  • __TOP_ContactUs__
  • __TOP_About__
  • __TOP_Privacy__
  • __TOP_Termsofuse__
  • __TOP_FAQ_
  • __TOP_Feedback__
  • __TOP_Aff__
  • __TOP_Invitefriend__
  • __TOP_Bookmark__
  • __switch_lang_block__
    Now I assume these represent the small links at the very top of the Dolphin interface, since we all know that you can alter the navigation via the Navigation builder in the administration panel.  If you look at line 33 & 34 you'll notice that there is a __top_menu__ and __hidden_menu__ variable, these are the actual generated links that are customizable, so you will need these variables in your templates.  There are also some other variables you may want to keep in the _header.html for your template, I'd definitely keep the __main_logo__ and __hello_member__ variables, I'll explain what each one 'seems' to do below.

FYI: When searching in Dreamweaver for these variables, remove the dual underscores before and after the variable, it helps a lot.  You'll also want to search the "Folder" of dolphin root, not just a file and click "Find All", makes it way easier.

NOTE: When editing any of the following files, take heed to the php variables and do not alter them, these are important to the processing of the file. Alter these at your own risk!!!
  • __top_menu__
    • found in /inc/design.inc.php :: line 509
    • associated with getTopMenu() function inside a type of array it seems
    • getTopMenu() is found in templates/tmpl_uni/scripts/BxBaseMenu.php & templates/tmpl_uni/scripts/BxTemplMenu.php
    • getTopMenu() in BxTemplMenu.php checks to see if a user is logged in with the $logged[] array and if the user isn't it set's the $memberID to 0
      • inside the function seems to be a random variable which is used throughout the system called $ret, useful way to do something ya think?  Sarcasm not intended
      • Line 45 seems where the action takes place, it calls to a function TopMenuDesign()
      • TopMenuDesign() function is found in /inc/menu.inc.php which on line 270 runs a foreach() loop to put the links that were customized in the administrator panel into the page.
    • As far as customization seems, looks like it should take place in the BxTemplMenu.php file on lines 41-50 since these are the general layout divs.

  • __hidden_menu__
    • fount in /inc/design.inc.php :: line 510
    • associated with getAllMenus() function
    • getAllMenus() is found in /inc/menu.inc.php :: line 377
      • This is kind of self explanatory on what this function does, but in case you don't know, it pulls all sub menus that were placed under the links in the administrator navigation menu builder application.
    • customization should only occur on lines 426-436 even then, I would not recommend doing so since this is a core file.  Do so at your own discretion.

  • __main_logo__
    • found in /inc/design.inc.php :: line 491
    • associates with getMainLogo() function
    • getMainLogo() is found in /inc/design.inc.php :: line 1216
      • No need for customization here it just pulls the logo stored in the Database and puts it in an image tag wrapped by an anchor tag (image link) which links back to the homepage.

  • __hello_member__
    • found again in /inc/design.inc.php :: line 572
    • associates with HelloMemberSection() function
    • HelloMemberSection() is found in /templates/tmpl_uni/scripts/functions.php :: line 159
      • This function as with most uses an if()...else() statement layout; it first checks to see if the user is logged in, and displays the thumbnail and links to his/her account, mailbox, profile, and presence along with a logout link provided he/she is logged in.
      • If the login credentials are supplied and the user is an 'admin' according to the $logged[] array then there is simply the users thumbnail and a link to the administration panel and a logout link.
      • If the credentials aren't supplied then the user is only shown two links to either Join or Login
    • Editing on this file should only take place on lines 172-185 for logged in 'users' not Administrators and lines 191-202 for Administrators.  For non logged in users you should only edit lines 208-213.
I hope this little blog post helped you out a little and I will definitely be adding more as soon as I get back to work the next day.  So far this takes care of the _header.html file, I hope to figure out what values do what soon, I will be taking a look into the $logged[] array as soon as possible along with what the hell the designbox html files do and what they're for.

Any suggestions or recommendations you have please PM me.


 
Comments
·Oldest
·Top
Please login to post a comment.
jaruzek
I'm totally bookmarking this. It'll be useful if I can ever get my install working right...oy.
swingfel
please could someone help me, I have a new template but don't know how to install it ???

PLEASE
khandor_nayan
Can u pls help me.
I want to add view and edit profile links along with all the links which is required after the user is logged in in a html block.
Thanks
Regards
Nayan khandor
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.
PET:0.062389850616455