Results 1 to 6 of 6

Thread: <!-- <?php $this->showTemplateVars(); ?> -->

  1. #1
    Experienced user
    Join Date
    06-10-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default <!-- <?php $this->showTemplateVars(); ?> -->

    This is the most important line you will use when modifying your templates and adding custom code -- e.g. pop-up teasers, special mootools effects, or just plain knowing which variables to write out where.

    (use the view|source to see the variables)

    Place this in the first line of your template code, e.g. news_latest.tpl, etc.

    Enjoy.

  2. #2
    User
    Join Date
    06-29-09.
    Posts
    271

    Default Re: <!-- <?php $this->showTemplateVars(); ?> -->

    Very nice!

    Or alternatively you might use:
    Code:
    <pre><?php $this->showTemplateVars(); ?></pre>
    This will mess up most views, but if you are interested in the available variables this saves you the view source. Both options have pros and cons

  3. #3
    User
    Join Date
    06-19-09.
    Posts
    328

    Default Re: <!-- <?php $this->showTemplateVars(); ?> -->

    Quote Originally Posted by Vera
    Very nice!

    Or alternatively you might use:
    Code:
    <pre><?php $this->showTemplateVars(); ?></pre>
    This will mess up most views, but if you are interested in the available variables this saves you the view source. Both options have pros and cons
    and/or replace the
    Code:
    <pre>
    tag with
    Code:
    <xmp>
    tag if the template variables contains html code
    Consulenza Contao CMS https://www.intco.it

  4. #4
    Experienced user
    Join Date
    06-10-09.
    Location
    Atlanta, Georgia
    Posts
    611

    Default Re: <!-- <?php $this->showTemplateVars(); ?> -->

    Wow - that's super helpful! It just helped me out with a custom news template I was working on. I feel like I've been flying blind on non-catalog templates before knowing this trick.

  5. #5
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: <!-- <?php $this->showTemplateVars(); ?> -->

    That is helpful....
    I tried all three, and the winner is
    ........drrrrrrrrrrrrrrrrrrrr
    drumroll please...
    drrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr rrr
    do-do-do-doot-do-do.
    .
    .
    .
    .
    . Fllllllllooooo..vverrrrr..fl.vvv...THYON!
    For the ease of being able to read the vars alongside of your non-broken up page.

    Thanks for the tips all.

  6. #6
    Experienced user
    Join Date
    06-10-09.
    Location
    Atlanta, Georgia
    Posts
    611

    Default Re: <!-- <?php $this->showTemplateVars(); ?> -->

    I came up with an interesting solution to put the variables in a lightbox, but this forum doesn't seem to like my code. I'll keep adding pieces here until it blows up.

    I got things working in a lightbox (mediabox) with the following code. The only problem is that I can't get the overflow to scroll properly. Maybe someone here knows how to get this working. Add "overflow: scroll;" to the div style didn't work.
    Code:
    template variables
    <div id="mb_variables" style=(quote)display: none;(quote)><pre><?php $this->showTemplateVars(); ?></pre></div>
    For some reason this forum rejects the code so you'll need to replace where it says (quote) with " in line 2 above.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •