Page 1 of 1
Exactly what tags are available from a template?
Posted: Tue Nov 20, 2007 2:01 am
by greenmile
Hello,
Just installed CMSMS last night and already today I have a nearly-working website rolling.
I had a question, though, about exactly the information I can retrieve from my template page.
I know of the basic tags such as:
{sitename}
{stylesheet}
{content}, etc.
But, is there a definitive list of all other tags I can use (not the standard ones, I saw that list. I'm talking about others)?
I'm trying to get access to the current URL-format of the page name that I'm currently viewing. I'm not sure if I can get this from the template... and if not, where can I get it? Do I need to make a custom tag for this?
It seems like it would be cool to put little php scriptlets embedded in the template if so need be. Am I missing something here?
Thanks,
greenmile
Re: Exactly what tags are available from a template?
Posted: Tue Nov 20, 2007 2:37 am
by calguy1000
use {get_template_vars} to see what tags are available.
if the output from that says that the variable contains an object, and/or you're inside of a foreach loop, you can use {$objectname|print_r} to dump out the contents.
TIP: putting those tags inside of an html comment will make it so that you can view what's happening withoug corrupting your output.
like: or, if inside of a foreach loop, something like: will dump out alot of useful information without corrupting your output.
Re: Exactly what tags are available from a template?
Posted: Tue Nov 20, 2007 3:20 am
by greenmile
Thanks a lot for the quick reply.
That worked great for me. I was able to get out the page name (the URL-formatted string) to form a URL I needed.
Back to top
Also, nice tip about outputting to HTML comments.
Thanks again,
greenmile
Re: Exactly what tags are available from a template?
Posted: Tue Nov 20, 2007 10:16 am
by faglork
greenmile wrote:
I was able to get out the page name (the URL-formatted string) to form a URL I needed.
Back to top
What do you need the $page_name for?
Since you can use an element ID in anchors, just use an existing element on the top of the page. I used the "skip navigation list" for that:
In my template I added an ID to the UL:
Code: Select all
<div id="pagewrapper">
<ul id="top" class="accessibility">
<li><a href="/xxxx.html#menu_vert" title="Skip to navigation" accesskey="n">Skip to navigation</a></li>
<li><a href="/xxxx.html#main" title="Skip to content" accesskey="s">Skip to content</a></li>
</ul>
which you then can access like
hth,
Alex
Re: Exactly what tags are available from a template?
Posted: Tue Nov 20, 2007 7:00 pm
by greenmile
faglork wrote:
What do you need the $page_name for?
Since you can use an element ID in anchors, just use an existing element on the top of the page. I used the "skip navigation list" for that:
In my template I added an ID to the UL:
Code: Select all
<div id="pagewrapper">
<ul id="top" class="accessibility">
<li><a href="/xxxx.html#menu_vert" title="Skip to navigation" accesskey="n">Skip to navigation</a></li>
<li><a href="/xxxx.html#main" title="Skip to content" accesskey="s">Skip to content</a></li>
</ul>
which you then can access like
hth,
Alex
The problem with that is, you have different HTML files for each page it looks like.
In my case, each page URL is structured like:
index.php?page=this_page
index.php?page=that_page
So, when you try to link something like
The browser attempts to load that anchor off the root of "index.php" (without the query string), therefore the link always goes back to the home page before positioning the anchor.
Because of this, I have to link the fully-qualified URL (with the query string) before the "#", so that it looks like
index.php?page=this_page#
Perhaps I'm missing something and this could have been done more easily, but this solution does work.
Either way, I'm glad I know that I can get the page name out of the template if I ever need it again. This is a helpful forum.