Joomla Variables

Your code modifications and patches you want to share with others.
Locked
ddmobley
Joomla! Intern
Joomla! Intern
Posts: 90
Joined: Thu Jun 15, 2006 2:18 am

Joomla Variables

Post by ddmobley » Fri Jun 16, 2006 4:37 am

Is there a document that has all the available variables one could use in building customer templates?  I would think having a template variable definition document would make a lot of sense.

jpease
Joomla! Apprentice
Joomla! Apprentice
Posts: 12
Joined: Tue Sep 13, 2005 6:36 pm

Re: Joomla Variables

Post by jpease » Sat Jul 22, 2006 1:26 am

No kidding.  I definitely second this.  Is there any info on what variables are available from a template?

ddmobley
Joomla! Intern
Joomla! Intern
Posts: 90
Joined: Thu Jun 15, 2006 2:18 am

Re: Joomla Variables

Post by ddmobley » Sat Jul 22, 2006 2:23 pm

Apparently we are the only ones that feel this way, since it took over 30 days for me to even get one response.  A document of available template variables should be the basis for ANY add-on application or free-standing development built for Joomla, but apparently we are on our own.

Broekie
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Mon Sep 04, 2006 9:23 am

Re: Joomla Variables

Post by Broekie » Mon Sep 04, 2006 9:25 am

Has anybody found a list of variables and functions yet?

I'm designing a template as we speak, and I was surprised by the fact that functions like mosPathWay() and variables like $mosConfig_sitename don't appear to be documented...

teho
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Fri Sep 08, 2006 12:29 pm

Re: Joomla Variables

Post by teho » Sun Sep 10, 2006 8:48 pm

ddmobley wrote: Is there a document that has all the available variables one could use in building customer templates?  I would think having a template variable definition document would make a lot of sense.
Agree!!!

There must be something somewhere. I am now in the mood for Drupal since I cant find documentation for anything at Joomla. To search the forums for everything should not be necessary. I have just wasted one hour searching for information about variables with luck.

- Terje

effectus
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Mon Dec 25, 2006 2:30 pm

Re: Joomla Variables

Post by effectus » Wed Nov 05, 2008 12:28 am

I agree too. I'm desperately looking for a couple of hours now for such a thing - HELP!!!

User avatar
OnTheMarkDesign
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 191
Joined: Thu Apr 24, 2008 10:11 pm
Location: Inland Empire, California, USA
Contact:

Re: Joomla Variables

Post by OnTheMarkDesign » Wed Nov 05, 2008 5:33 am

ddmobley wrote:Is there a document that has all the available variables one could use in building customer templates?  I would think having a template variable definition document would make a lot of sense.
Check in the Documentation area of the Joomla site. If there hasn't already been a document listing all the available variables started, take the initiative and start it!
Joomla! Community Magazine Team Member
Follow Me at https://twitter.com/OnTheMarkDesign

mic
Joomla! Guru
Joomla! Guru
Posts: 692
Joined: Thu Aug 18, 2005 10:51 pm
Location: Austria
Contact:

Re: Joomla Variables

Post by mic » Wed Nov 05, 2008 6:30 am

OnTheMarkDesign wrote:Check in the Documentation area of the Joomla site. If there hasn't already been a document listing all the available variables started, take the initiative and start it!
As i understood the former postings, they are newbies.
So how they can start a (new) documentation?
But it seems that you are knowing more about - why not you?
http://www.joomx.com - custom extensions and development
http://www.joomlasupportdesk.com - support, migration, training and consulting
Member of the German Joomla Translation Team

deccypher
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Sun Oct 19, 2008 6:29 pm
Location: USA
Contact:

Re: Joomla Variables

Post by deccypher » Wed Nov 05, 2008 7:18 am

a cumbersome way of doing this would be to write something like this

<?php
session_start();
foreach($_SESSION as $key => $val)
{
echo $key . " : " . $val . "<br>";
}
?>

you would need it on the footer or index page and then as you navigate your site you would see all the session variables and their values.. this would let you build up a library very quickly with quick copy and paste
Mambo was great joomla looks to be better

User avatar
OnTheMarkDesign
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 191
Joined: Thu Apr 24, 2008 10:11 pm
Location: Inland Empire, California, USA
Contact:

Re: Joomla Variables

Post by OnTheMarkDesign » Wed Nov 05, 2008 6:42 pm

mic wrote:
OnTheMarkDesign wrote:Check in the Documentation area of the Joomla site. If there hasn't already been a document listing all the available variables started, take the initiative and start it!
As i understood the former postings, they are newbies.
So how they can start a (new) documentation?
But it seems that you are knowing more about - why not you?
Let me look into the Documentation section regarding the "variables". If nothing is already started, I'd be interested in "collecting" the variables for a "listing page" of them.
Joomla! Community Magazine Team Member
Follow Me at https://twitter.com/OnTheMarkDesign

effectus
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Mon Dec 25, 2006 2:30 pm

Re: Joomla Variables

Post by effectus » Thu Nov 06, 2008 10:05 pm

OnTheMarkDesign wrote:
mic wrote:
OnTheMarkDesign wrote:Check in the Documentation area of the Joomla site. If there hasn't already been a document listing all the available variables started, take the initiative and start it!
As i understood the former postings, they are newbies.
So how they can start a (new) documentation?
But it seems that you are knowing more about - why not you?
Let me look into the Documentation section regarding the "variables". If nothing is already started, I'd be interested in "collecting" the variables for a "listing page" of them.
I thank you, good people, for your efforts.

User avatar
OnTheMarkDesign
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 191
Joined: Thu Apr 24, 2008 10:11 pm
Location: Inland Empire, California, USA
Contact:

Re: Joomla Variables

Post by OnTheMarkDesign » Fri Nov 07, 2008 2:33 am

effectus wrote:
I thank you, good people, for your efforts.
I've learned a lot from the others who posted their problems (and solutions) here in the Joomla Forums. Bookmarking or subscribing to a thread has come in very handy while building my first 3 Joomla sites.

I'm working on a "core elements" document that lists all the modules/plugins/etc. that I utilize in my Joomla sites. And a checklist of what I've done with each site.

Search is your friend on this Forum. Joomla is an everchanging tool.

The Documentation of Joomla is one area that could be "worked" on! I've learned much about Joomla while reading the Joomla Documentation Wiki! while doing some "editing" on the current articles in the Wiki.
Joomla! Community Magazine Team Member
Follow Me at https://twitter.com/OnTheMarkDesign

User avatar
OnTheMarkDesign
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 191
Joined: Thu Apr 24, 2008 10:11 pm
Location: Inland Empire, California, USA
Contact:

Re: Joomla Variables

Post by OnTheMarkDesign » Fri Nov 07, 2008 3:01 am

ddmobley wrote:Is there a document that has all the available variables one could use in building customer templates?  I would think having a template variable definition document would make a lot of sense.
Template FAQ's from Joomla Documentation might be a place to start!
Joomla! Community Magazine Team Member
Follow Me at https://twitter.com/OnTheMarkDesign

effectus
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Mon Dec 25, 2006 2:30 pm

Re: Joomla Variables

Post by effectus » Sun Nov 09, 2008 12:16 am

@OnTheMarkDesign: Thanks for your work - looking forward to it.

Thanks for the tips too. Of course I first tried searching the forum, as well as the wiki, the documentation and the API. Nowhere could I find a clear list of typically-used variables and objects in a standard Joomla template. Tried a web search too - zilch.

Couldn't see anything related to this (vars, objects) on the template FAQ link either - am I missing anything?

User avatar
OnTheMarkDesign
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 191
Joined: Thu Apr 24, 2008 10:11 pm
Location: Inland Empire, California, USA
Contact:

Re: Joomla Variables

Post by OnTheMarkDesign » Sun Nov 09, 2008 4:58 am

effectus wrote:@OnTheMarkDesign: Thanks for your work - looking forward to it.
Appreciate the comment. It will take some time to "accumulate" the variables. Fortunately, Joomla comes with 2 front end templates, and 1 admin. template.
Thanks for the tips too. Of course I first tried searching the forum, as well as the wiki, the documentation and the API. Nowhere could I find a clear list of typically-used variables and objects in a standard Joomla template. Tried a web search too - zilch.

Couldn't see anything related to this (vars, objects) on the template FAQ link either - am I missing anything?
I just starting reading the Joomla Doc's. (Wiki) about a month ago. Have been on the Forum since April, and it has been a great resource along with 2 Books I have bought. Barrie Norths "Joomla, A User's Guide", and "Professional Joomla" by Dan Rahmel.

North's book covers the basics that you must know on how to make your Joomla site function. Rahmel's book covers more of the "complex" things like the "raw code" on Joomla, and developing your own modules and templates.

I'll investigate what has been done on the Wiki regarding the "variables" of the 3 templates. I do know that there is some content regarding the templates, but to what extent "I don't know at this point in time". If no one is currently working on such a "project" on the Wiki, I'd be interested in helping on it!
Joomla! Community Magazine Team Member
Follow Me at https://twitter.com/OnTheMarkDesign

effectus
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Mon Dec 25, 2006 2:30 pm

Re: Joomla Variables

Post by effectus » Sun Nov 09, 2008 1:44 pm

OnTheMarkDesign wrote: I just starting reading the Joomla Doc's. (Wiki) about a month ago. Have been on the Forum since April, and it has been a great resource along with 2 Books I have bought. Barrie Norths "Joomla, A User's Guide", and "Professional Joomla" by Dan Rahmel.
Got those 2 books myself :laugh:

They definitely help a lot in understanding how things work - but they lack good quick-references chapters that you can quickly refer to when working. This is where I think a good API reference comes in handy, but for Joomla the API is quite cryptic if you're not a pro.

Thanks again OnTheMarkDesign !

User avatar
Chris Davenport
Joomla! Ace
Joomla! Ace
Posts: 1385
Joined: Thu Aug 18, 2005 8:57 am
Location: Shrewsbury, Shropshire, United Kingdom

Re: Joomla Variables

Post by Chris Davenport » Sun Nov 09, 2008 3:13 pm

Apart from the automatically generated API documentation (http://api.joomla.org) we are in the process of writing additional material here: http://docs.joomla.org/API_Reference_Project

One of the great strengths of the Joomla 1.5 template architecture is that it gives you access to the full API from within the template, consequently there's an awful lot to document! However, in addition to the above-mentioned API Reference material, I do intend to work on more specific template documentation, but it is likely to be some months before it is ready.

Regards,
Chris.
Chris Davenport

Davenport Technology Services http://www.davenporttechnology.com/
Lion Coppice http://www.lioncoppice.org/

effectus
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Mon Dec 25, 2006 2:30 pm

Re: Joomla Variables

Post by effectus » Mon Nov 10, 2008 12:14 am

Chris Davenport wrote:Apart from the automatically generated API documentation (http://api.joomla.org) we are in the process of writing additional material here: http://docs.joomla.org/API_Reference_Project

One of the great strengths of the Joomla 1.5 template architecture is that it gives you access to the full API from within the template, consequently there's an awful lot to document! However, in addition to the above-mentioned API Reference material, I do intend to work on more specific template documentation, but it is likely to be some months before it is ready.

Regards,
Chris.
Great news, Chris. Really nice to see the progress Joomla is making - and these documentation news are a great example.

If it will be anything like the PHP documentation it wants to follow - coding for the 1.5 framework will be much simpler. Good on you!

User avatar
andpatton
Joomla! Apprentice
Joomla! Apprentice
Posts: 23
Joined: Fri May 29, 2009 3:50 pm
Contact:

Re: Joomla Variables

Post by andpatton » Fri May 29, 2009 4:42 pm

In working on a new template, I ran across this same question and uncovered this encouraging, though currently fairly unhelpful, thread. However, I did take people's queues and gave the Template category in the Joomla! Documentation wiki a shot. One of the articles I discovered was this one:
How are templates executed?

According to that article,
J!Documentation wrote:Templates are executed in the context of the document object so that the $this object is always the instantiation of the JDocument class.
Ahah, I thought, all I need to do now is check the variables and methods of the JDocument class in the joomla API (JDocument Class), and I'll have a nice list of variables and methods available through the $this object from within a template index.php file.

While those would seem to be usable variables and methods, I also noticed that it doesn't mention the ubiquitous $baseurl variable that every template uses to link to stylesheets and images and the like. As it turns out, that variable is assigned in the render() method of the JDocumentHTML class (around line 217 of /libraries/joomla/document/html/html.php), which is the method responsible for "Outputting the template to the browser." In that method, the $this->template variable (the name of the directory containing the current template) and the $this->baseurl variable are both assigned, as well as a $this->params object, which is generated from the params.ini file of your current template.

So, the full list? Well, if you want to mess with methods, I suggested reading up on the JDocument Class on your own and trying to figure them out, but the list of variables (accessible from the $this object) is as follows, as far as I can tell (all are strings, unless otherwise noted):

Code: Select all

$this->baseurl;
$this->template;
$this->params; // Template specific params object -- defined in the params.ini file
// From JDocument:
$this->base; // Document base URL -- redundant, as far as I can tell
$this->description; // Document description
$this->direction; // Contains the document direction setting (default='ltr')
$this->language; // Contains the document language setting (default='en-gb')
$this->link; // Document full URL
$this->title; // Document title
$this->_generator; // Document generator (default='Joomla! 1.5 - Open Source Content Management')
Disclaimer: I have only actually ever used $this->baseurl, $this->template, and $this->language (very useful for developing a multi-lingual site), so I can't vouch for how the others will behave. If anyone else feels like sharing their experiences, please do so!

pedsola
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Wed Aug 19, 2009 10:27 pm

Re: Joomla Variables

Post by pedsola » Wed Aug 19, 2009 10:41 pm

ddmobley wrote:Is there a document that has all the available variables one could use in building customer templates?  I would think having a template variable definition document would make a lot of sense.

http://docs.joomla.org/Constants

i'm sure there are more, but these are some


Locked

Return to “Core Hacks and Patches”