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
Exactly what tags are available from a template?
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
Re: Exactly what tags are available from a template?
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.
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.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Re: Exactly what tags are available from a template?
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
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?
What do you need the $page_name for?greenmile wrote: I was able to get out the page name (the URL-formatted string) to form a URL I needed.
Back to top
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>
Code: Select all
<a href="#top">Back to top</a>
Alex
Re: Exactly what tags are available from a template?
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:which you then can access likeCode: 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>
hth,Code: Select all
<a href="#top">Back to top</a>
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
Code: Select all
<a href="#top">Back to top</a>
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.