Announcement

Collapse
No announcement yet.

template help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • template help

    ok if i had the template 'home2'and i have a template 'home',
    how would i get home2 to show in home?

  • #2
    Include this code in your php file:

    PHP Code:
    eval('$home2 = "' fetch_template('home2') . '";'); 
    Then, use the variable $home2 in the home template.


    And next time, ask at vBulletin.org, as this has to do with coding
    Best Regards
    Colin Frei

    Please don't contact me per PM.

    Comment


    • #3
      Hey collin,Just wanted to add that vB.org isn't the best for this type of question.They are good for lots of coding questions but this one in particullar i couldn't get an answer for from vB.org no matter how many times i asked.

      Comment


      • #4
        Or, if you do not feel comfortable modifying PHP files, you could create a plugin for this.

        AdminCP -> Plugin System -> Add New Plugin

        For the hook location select 'parse templates'

        Then enter a title so you can easliy identify it if you ever want to change it

        For the PHP code, enter the following

        PHP Code:
        eval('$home2 = "' fetch_template('home2') . '";'); 


        Set 'Plugin is Active' to yes.

        Now, you can use the variable $home2 to call the code from the 'home2' template in your 'home' template, or any other template you may want it in.
        vbStartup.com: vBulletin 3.7 Styles | vBulletin Tutorials

        Comment


        • #5
          Did you test this?
          Without checking, I feel that this'll generate a loop...
          Best Regards
          Colin Frei

          Please don't contact me per PM.

          Comment


          • #6
            Yea, I tested it.

            Why might it generate a loop?
            vbStartup.com: vBulletin 3.7 Styles | vBulletin Tutorials

            Comment


            • #7
              Because you're calling a fetch_templates when parsing the templates, which would parse the templates again and so on.

              Also, wouldn't this parse the home2 template on every page?
              Best Regards
              Colin Frei

              Please don't contact me per PM.

              Comment


              • #8
                Only if it were called by $home2 on every page...
                vbStartup.com: vBulletin 3.7 Styles | vBulletin Tutorials

                Comment


                • #9
                  No, the template will get parsed if you call it or not.
                  Best Regards
                  Colin Frei

                  Please don't contact me per PM.

                  Comment


                  • #10
                    Alright... However, I tested the above code before posting and it worked fine for me (no loop); so I anticipate no problems using it for what he wants to do. But to be on the safe side... What hook would you recommend?
                    Last edited by vbStartup; Sun 9th Oct '05, 7:52am.
                    vbStartup.com: vBulletin 3.7 Styles | vBulletin Tutorials

                    Comment


                    • #11
                      Using that hook would work, but it makes sense to adjust the code along these lines:

                      Code:
                      if (THIS_SCRIPT == homepage)
                      {
                      eval('$home2 = "' . fetch_template('home2') . '";');
                      } 


                      Or, one could check if the called template is home or something.
                      Best Regards
                      Colin Frei

                      Please don't contact me per PM.

                      Comment


                      • #12
                        thanks guys
                        i was making a hole new page so the php one was good for me
                        everything is working perfect so i inted to release my mod soon

                        Comment


                        • #13
                          I tried both suggestions and neither worked...

                          I created an alternate header template that I want to use for my error pages and for the login page

                          new template --> header2

                          edited login.php and added (does it need to go anyqhere in particular?):
                          PHP Code:
                          eval('$header2 = "' fetch_template('header2') . '";'); 
                          in my error template I replaced

                          PHP Code:
                          $header 
                          with
                          PHP Code:
                          $header2 
                          No result...

                          Then I tried the plugin and nothing no result either...

                          Any advice or guidance would be appreciated...
                          MORE | UnitedMania

                          Comment


                          • #14
                            Please disregard my previous post - The plug-in worked when I specified the specific page I wanted it applied to...
                            MORE | UnitedMania

                            Comment

                            widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                            Working...
                            X