Results 1 to 3 of 3

Thread: A New Template Module which Shows Different Content per Category

  1. #1

    Question A New Template Module which Shows Different Content per Category

    I wanted to create a new module to put on to the Browse Category page which will show some different text for each category.

    For this purpose I decided to add a new template module.

    So I created a new template (ACP > Styles & Templates > Style Manager > Add New Template, for selected style) and I added the following code to my template:
    <div>
    <vb:if condition="$catid == 2">some text about category 2</vb:if>
    <vb:if condition="$catid == 1">some text about category 1</vb:if>
    </div>

    I then made a new template module (ACP > VBa Dynamics instance > Add module > template) and edited the module layouts to add the new template module I created, to the Browse Category page in the right column.

    However the text with the vb:if-conditional surrounding it did not show up on the page, but when the conditional was removed the text showed up fine.

    Although I found that the above code does not work if it is put in a template module which is then subsequently put on to the Browse Category page, I did however find that it works fine if I put the same code directly in the ADV_DYNA_BROWSECATEGORY template.


    So my questions are; am I doing something wrong in creating the conditional for the new template module? Is there a way for me to get some different bits of text to come up in a custom module when viewing each category?


    Thank you in advance for your help.


    tfm (posting from aam's account)
    Last edited by aam; 01-05-2013 at 06:09 PM.

  2. #2
    Join Date
    Jan 2004
    Location
    Georgia, USA
    Posts
    34,466

    Default

    The $catid variable would not be globalized within your custom template. Try adding a new plugin with the following values and that should take care of the issue.

    Product: vBa Dynamics
    Hook Location: vba_dyna_browsecategory_start
    Title: Globalize $catid For Module
    Execution Order: 5
    Plugin PHP Code: Be sure to change your_template_name_here in the code below to the name of your custom template.
    PHP Code:
    vB_Template::preRegister('your_template_name_here', array('catid' => $catid)); 
    Plugin is Active: Yes
    Frequently Asked Questions
    CMPS Users Manual

    For vBadvanced software assistance, please use the support forums.
    Unsolicted PMs, IMs, and email will not be responded to.
    If you have a non-software related question or problem with your account, please submit a support ticket.

  3. #3

    Default

    Thank you Brian, your suggestion worked.


    tfm (posting from aam's account)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Custom Content Template?
    By Albus in forum "How Do I..." Questions
    Replies: 2
    Last Post: 04-30-2008, 01:08 PM
  2. Template module with variable content based on forumid
    By Neutral Singh in forum "How Do I..." Questions
    Replies: 4
    Last Post: 12-26-2007, 05:48 PM
  3. Module content shows above header
    By LoOnEyToOnZ in forum Troubleshooting & Problems
    Replies: 2
    Last Post: 11-09-2005, 12:54 PM
  4. Multipage 'custom content' with only one template... possible?
    By AlfonsoC in forum Troubleshooting / "How do I..." Questions
    Replies: 5
    Last Post: 02-07-2005, 02:02 AM
  5. Nothing shows with cutom page content
    By Shoe in forum Troubleshooting / "How do I..." Questions
    Replies: 1
    Last Post: 05-30-2004, 12:26 PM

Posting Permissions

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