XTE Support  :: 
Different templates for different modules
 Top

  • I thought I'd find the answer easily. I haven't, so I'm afraid I'll have to ask here. Sorry if I've not searched using the right words.

    I'm developing a Shop module ('cos I'm tired of waiting for one that fits my needs), but when my customers are in the shop, I'd like the module to use a different template with different right hand blocks - cart, reviews, recently viewed, etc.

    Now, I'm assuming I need to put a different template called shop.htm in /theme//modules but can't really work it all out. Perhaps there's a different/better way of doing it.

    I'd like to do this from the command line, not through the UI too. I really like to know what I'm doing (not that I do in this case yet).
  • Create a new template, then create a zone, select the module and select the template. Just don't include the rightblocks in the new template, but create your own module templates to show your custom blocks. Most Xanthia themes comes with a master.htm that doesn't use the right blocks.

    Maybe this is something you're looking for? http://www.natewelch.com/modules.php?op=modload&name=Sections&file=index&req=viewarticle&artid=5

    --
    Doe Maar Freak
  • I can create a new template for my theme simply by using cp and vi... from there you've lost me.

    Firstly, I don't understand how to make my module use the new template.

    How do I create a zone?
    Where do I select the module and template?

    Presumably this new zone is some sort of "block position tag" like $rightblocks, so where do I code up what blocks are included in that zone?

    I've had a play in the Xanthia admin pages, but that just does my head in. No doubt PN.8 will make it all very easy and obvious and well documented somewhere.
  • First create a shop.htm, based on the contents of master.htm but modified to your needs. i.e. replace

    Code

    <!--[$rightblocks]-->
    with some nice addons you would like in that template. FTP that file to /themes/YOURTHEME/templates/modules/


    The following step is just to tell Xanthia a new template is uploaded. So, go to Xanthia admin, edit your theme theme, and click the templates tab. Click "New module template", and use "shop.htm" as a title. Copy the contents of your file into that textarea and click "Submit". (since you should configure Xanthia to not use templates in the DB, but use them from the filesystem, this step is only to not have you delete and add your theme again to show the uploaded file)


    Then, go to the "Content Wrappers" tab and click "[ Add new wrapper ]". Define a custom 'name' for it (choose it as you like). Then, next to "New master for module", you select your shop-module. The "Label" field will be filled in automatically for you. Leave the rest unbothered and click Commit.


    Finally, at the bottom of the wrapper list, you see your newly created wrapper. Click "Configure" at the right of it and select your shop.htm template (which you uploaded and added through the Xanthia template admin interface. Then, activate the wrapper by clicking "Activate".


    The module template should now work.


    dunx

    Presumably this new zone is some sort of "block position tag" like $rightblocks, so where do I code up what blocks are included in that zone?

    I've had a play in the Xanthia admin pages, but that just does my head in. No doubt PN.8 will make it all very easy and obvious and well documented somewhere.


    This is something else: block positions allow you to add more positions than the standard left, center and right, and has nothing to to with specific module templates.


    In your shop.htm, you could choose to replace

    Code

    <!--[$rightblocks]-->
    with for example

    Code

    <!--[$SHOPBLOCKS]-->
    . This way, you don't have to manually add all your contents to shop.htm, but let the system define them for you.


    For this to work, follow the procedure above, but afterwards, add more wrappers: not one for the shop module, but one for each BLOCK you wish to use (the label will read the block title without spaces).


    After that, you go to the "Block position tags" tab and add add the tag described above to the "Tag to use in theme" field.


    After that, go to the "Block control" tab. Next to "Module", choose your shop module. Select all the blocks (using CTRL to select multiple items) you wish to use in that template, INCLUDING the top "--Block Control" entry in that list, and click "Update".


    When done, Find your module in that list below and make sure that all your block have the right zone: SHOPBLOCKS


    I guess you have to play around with the system a bit, this is all I can add for now. Or wait for .8 to come out. Indeed, this is much, much, much easier there, and maybe worth to wait for.

    --
    -- Teb
    -- Dutch Zikula Community


    Support questions in a Personal Message will be ignored. Use the forums at all times!
  • Teb, great advice and it got me as far as a different template for my shop.

    I then tried to add the basket block.
    I created a "block position tag" called $_SHOPRIGHTBLOCKS wrapper all fine.
    I added that to my shop.htm template.

    I then added a "content wrapper" called shop_basket with a label of "shopbasket". This used rsblock.htm which is fine for me.

    I then go to "template control", select my Shop module... but I can't see anything to do with my block in the list beneath. The list just seems to be a list of those blocks that already exist on my site.

    Anyway, just to see what would happen, I selected one of those and sure enough I can see that on the right column of my shop template... but the left hand column is now blank. I looks like adding one block to my template, loses the others... so I added those back in manually. That sort of implies I don't need a SHOPRIGHTBLOCK at all. I can just define manually what blocks I want to appear Left and Right for my Shop through "Block control" icon_confused

    So a few more questions.
    1. How do I get my block to appear in the list available for block control? The block exists and the template exists. Presumably I need to let Xanthia know it exists?? This is obviously the biggest problem I have.
    2. Why does $leftblocks stop working when I start to use Block control?
    3. This is all good for the User's view of Shop, but I notice that when I'm in Admin mode the new template is also used. I don't really want that (although I could live with it).

    I can add a new Basket block from the standard Block menu. This will show on all pages (including my shop.htm template if I specifically add it using Block control), but that's obviously not what I want. I just want it in my shop.

    Can anybody point to any documentation that covers this topic, or has it al been dumped because .8 is "coming soon"????

    If we all waited for .8 we'd never get anything done, but I do hope it's much, much easier than this in .8.



    edited by: dunx, Dec 15, 2006 - 12:20 AM
  • Okay, I think I understand a bit more now.

    My module is no longer using the Block module configuration because I've turned on block control for that module, which overwrites normal block control through the Block module. Fair enough I can live with that.

    The list of blocks available under Block control are taken from the nuke_blocks DB table.

    This means that to add a block to my module template I first need to add it as a normal block under the Block module. It also needs to be active otherwise it won't appear in the Shop template. The trouble is, this has the effect that it also becomes visible on *all* other templates. In the Blocks module there was no option to put the block in the "shopright" position, which was I was expecting. This option is available in Xanthia's block position.

    It seems odd that Block control has loads of options, but I still need to create the block under the Blocks module before I can select it from Xanthia's Block control.

    Do I have to code the block to not display if it's not being used in the Shop module? That seems at odds with all this configuration, i.e. I could do that not have done *any* of the other stuff mentioned in this thread.

    Surely, there's some documentation or words of wisdom that explain how to use Xanthia somewhere? I've gone back 2 years through this forum and nothing obvious. I'm not going to mention the state of the user/develop documentation on the main site - that seems to have gone backwards.
  • I staggered through adding a new block position and documented my process here:

    http://www.bbirney.com/Page-32.html

    Turns out it can be done. I admit, I was a doubter.

    --
    --
    Ben Birney
    http://www.tilsontech.com/
    http://www.sophiasfall.com/
  • bbirney

    and documented my process here:

    http://www.bbirney.com/Page-32.html]


    Kudos, as much as I can do it I'll be damned if I could explain it.


    --
    Under Construction!
This list is based on the users active over the last 60 minutes.