Page 4 of 6 FirstFirst ... 23456 LastLast
Results 31 to 40 of 60
  1. #31
    Join Date
    Sep 2006
    Location
    Jacksonville, FL
    Posts
    236
    Plugin Contributions
    0

    Idea or Suggestion Re: Switching templates at run time

    SOLUTION (semi):

    I've seen this error message before after ftp-ing files, they would have spaces at the bottom of the them and id have to go in and remove the spaces until the errors went away. These files had no spaces on the bottom. When i was testing, i only had one product in my category. I put a second product in and the problem was solved. Anyone know what might cause this?
    John L.
    MultiMedia Designer

  2. #32
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Switching templates at run time

    No, but someone else recently had the same issue of some problem with *one* product in a category, that went away when a second product was added.

  3. #33

    Default Re: Switching templates at run time

    This would be a good one to look at again. Anyone have any success getting some code to work for switching templates at run time? I know 'eccentric' had gotten somewhere, but that solution doesn't seem to work for me.

    I need a different template for some cPath's which I can not achieve at all using css, no matter what I try.

  4. #34
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Switching templates at run time

    Sure. You can create your own init_templates.php file to override the default template directory for some of your categories and put it in your includes/init_includes/overrides folder. This is the approach used for the template switcher on the (sorry, site offline) site.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  5. #35

    Default Re: Switching templates at run time

    Yes, that template switcher site is quite impressive - a great introductory for people wondering about zen cart, and wanting to try different templates. My personal favorite is future zen, which I took up for my site in April of 2007.

    I will dig deep and try to figure out the code to work for the init_templates. I had tried experimenting with the coding that 'eccentric' had come up with at the beginning of this post, but to no avail. Will try again.

  6. #36

    Default Re: Switching templates at run time

    It seems that this needs a slight code change to work correctly
    (at least with my store).
    I wanted the functionality to change templates for just one category,
    so I could refine the template for category and product display.

    So after copying 'eccentric's code from the beginning of this post,
    I made a revision that is working correctly for me now.

    On line 37 of: includes/init_includes/overrides/init_templates.php make necessary adjustments...

    Code:
      
    if($_GET['cPath']) {
      switch($_GET['cPath']) {
       case $template_dir = "29"; // directory of your custom cPath template (includes/templates/29)
          break;
       case $template_dir = "29_30"; // directory your custom cPath template (includes/templates/29)
          break;
       case $template_dir = "29_31"; // directory your custom cPath template (includes/templates/29)
          break;
       case $template_dir = "29_32"; // directory your custom cPath template (includes/templates/29)
          break;
       case $template_dir = "29_33"; // directory your custom cPath template (includes/templates/29)
       
      default: // If none of the above 
      $template_dir = "future_zen"; // directory name of custom template (includes/templates/custom_template)
          break;
        }
      }
    So when a user goes to cPath 29, the program automatically loads the folder in the directory I created under includes/templates/29

    This directory should include all the files in my custom template (which is 'future_zen' in my case.
    I only copied the important template files that would be used, and didn't bother with the rest i.e. everything in the 'common' folder, everything in the 'images' folder etc.

    Next I ran into some error where the templates would be looking for a file in my custom folder on other parts of the site. The only thing is it doesn't automatically
    look in you custom folder, so you need to take these and copy them over
    to the regular directories. For example I use a drop down menu
    and it had a file in
    includes/languages/english/extra_definitions/CUSTOM_TEMPLATE/ ,
    so I copied it to
    includes/languages/english/extra_definitions/
    and that got it working.

  7. #37
    Join Date
    Jan 2005
    Posts
    43
    Plugin Contributions
    0

    Default Re: Switching templates at run time

    Is it able to change template for certain specific pages?

    like shippinginfo. home page. page-2. page-3 and so on.

    How to change the code to achieve that?

  8. #38
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Switching templates at run time

    Yes. You can create your own includes/init_includes/overrides/init_templates.php to override your normal template for any page by adding conditions or switch statements based on $_GET['page']. Though often using Zen Cart's ability to load different stylesheets for different pages is sufficient, and avoids the need for programming.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  9. #39
    Join Date
    Jan 2005
    Posts
    43
    Plugin Contributions
    0

    Default Re: Switching templates at run time

    I know,
    The most I want to know how to code to make home page to use its own template.
    I mean how to modify the $_GET['page'] code.

    I just don't want to show sidebox on home page.

  10. #40
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Switching templates at run time

    Turning sideboxes off doesn't require a separate template. It can be done by adapting this FAQ Entry.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

 

 
Page 4 of 6 FirstFirst ... 23456 LastLast

Similar Threads

  1. switching templates
    By RichardH in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 23 Jul 2008, 10:36 PM
  2. Switching php version in WAMP5 causes install to run
    By GreggShort in forum Installing on a Windows Server
    Replies: 2
    Last Post: 27 Jul 2007, 06:06 AM
  3. switching between templates
    By fairview in forum General Questions
    Replies: 4
    Last Post: 9 Apr 2007, 02:44 PM
  4. switching templates
    By onakat in forum Customization from the Admin
    Replies: 6
    Last Post: 3 Apr 2007, 10:18 AM

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
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR