| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Front page conditional for X-Cart 5 Flexy templates? | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Front page conditional for X-Cart 5 Flexy templates?
Is there a way to determine if tpl code is running specifically on the store's front page? For example, some to the effect of:
Code:
All I'm trying to do is inject some text into the homepage / front page and not on every sub page and category page. Thanks! -Paul
__________________
X-Cart Version: 5.2 |
|||||||
#2
|
|||||||||
|
|||||||||
Re: Front page conditional for X-Cart 5 Flexy templates?
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
#3
|
|||||||||
|
|||||||||
Re: Front page conditional for X-Cart 5 Flexy templates?
Code:
__________________
Sincerely yours, Sergey Fomin X-Cart team Chief support group engineer === Check this out. Totally revamped X-Cart hosting http://www.x-cart.com/hosting.html Follow us: https://twitter.com/x_cart / https://www.facebook.com/xcart / https://www.instagram.com/xcart |
|||||||||
|
#4
|
|||||||
|
|||||||
Re: Front page conditional for X-Cart 5 Flexy templates?
Quote:
Exactly what I was looking for. Thank you kindly! Do you have any suggestions on how to learn what functions are available for X-Cart 5? I have had very mixed success navigating the documentation on my own.
__________________
X-Cart Version: 5.2 |
|||||||
#5
|
|||||||||
|
|||||||||
Re: Front page conditional for X-Cart 5 Flexy templates?
I was glad to help you.
Just for your further reference: 1) Product page {if:getTarget()=#product#} 2) Search page {if:getTarget()=#search#} 3) Checkout page {if:getTarget()=#checkout#} 4) Order confirmation ("Thank you for your order") page {if:getTarget()=#checkoutSuccess#}
__________________
Sincerely yours, Sergey Fomin X-Cart team Chief support group engineer === Check this out. Totally revamped X-Cart hosting http://www.x-cart.com/hosting.html Follow us: https://twitter.com/x_cart / https://www.facebook.com/xcart / https://www.instagram.com/xcart |
|||||||||
#6
|
|||||||||
|
|||||||||
Re: Front page conditional for X-Cart 5 Flexy templates?
Quote:
Every page has a controller class that handles its logic. You can find these classes in the \XLite\Controller\Customer namespace. The name of the controller class is determined from the "target" parameter. The default "target" is "main", that links to the \XLite\Controller\Customer\Main controller class. It is the home page. When you submit some data and want the controller to perform some action, you also submit the "action" parameter. X-Cart 5 checks the controller class, finds a matching "doAction{your_action}()" method and executes it. If there is no "action" parameter, X-Cart 5 executes the "doNoAction()" method. There is another method that is executed every page load: "handleRequest()". When the controller class has completed its work, X-Cart 5 starts rendering the page. The logic is as follows: - it renders the base template that adds multiple "view lists" - it looks for templates and widget classes having "@ListChild" directive and renders these into the "view lists" that are specified in the directive - these templates may add their own "view lists", so this is some kind of a loop - if a widget class wants to limit the "targets" where it should be rendered, it can use the static "\XLite\View\AView::getAllowedTargets()" method Inside template files you can access methods provided by the associated widget class and the controller class for the current "target". When you run something like "getTarget()" inside your template, X-Cart 5 looks for that method in the current widget class, and, if it is not there, it looks for the method in the controller class. "getTarget()" method is the controller's method that comes from the "\XLite\Controller\AController" class. When you render a base template, the associated widget class is \XLite\View\Controller. But as soon as you start rendering a widget, that widget's class becomes the "current" widget for all templates it renders (unless some other nested template renders another widget). I hope this clears the logic a bit. You may also check the existing source code and our knowledge base for examples - this may really help.
__________________
Alex Solovev, Qualiteam --- User manual Video tutorials X-Cart FAQ You are welcome to press "Thanks" button if you find this post useful Click here to learn how to apply patches X-Cart Extensions |
|||||||||
#7
|
|||||||
|
|||||||
Re: Front page conditional for X-Cart 5 Flexy templates?
Thanks Qualiteam, your direction is very helpful. Much appreciated.
__________________
X-Cart Version: 5.2 |
|||||||
|
|||
X-Cart forums © 2001-2020
|