Exactly what tags are available from a template?

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
greenmile
New Member
New Member
Posts: 9
Joined: Tue Nov 20, 2007 1:56 am

Exactly what tags are available from a template?

Post 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
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Exactly what tags are available from a template?

Post 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.
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.
greenmile
New Member
New Member
Posts: 9
Joined: Tue Nov 20, 2007 1:56 am

Re: Exactly what tags are available from a template?

Post 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
faglork

Re: Exactly what tags are available from a template?

Post 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

Code: Select all

<a href="#top">Back to top</a>
hth,
Alex
greenmile
New Member
New Member
Posts: 9
Joined: Tue Nov 20, 2007 1:56 am

Re: Exactly what tags are available from a template?

Post 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

Code: Select all

<a href="#top">Back to top</a>
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

Code: Select all

<a href="#top">Back to top</a>
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.
Post Reply

Return to “CMSMS Core”