Jump to content

Can anyone suggest me a if statement to display hooks based on URL ??


Recommended Posts

 {if $page.page_name == 'category'} 
                {hook h='Below'}
                {/if} 

if(isset($_GET['city']))

Currently iam using this command however it is not triggering the hook based on URL or category names. Can anyone suggest a if statement which enables a hook based on URL.

Link to comment
Share on other sites

Hi Sturen, Thanks for the reply but my requirement is i want to trigger a particular hook for a particular URL and not based on page. Yes which is why iam using if statement in layout.tpl sturen. but it is working only for pages like product, category and not URL. Any suggestion how to modify this statement to accommodate URL validation.

if statement to display on particular page.PNG

Link to comment
Share on other sites

The current url is stored in:

{$urls.value["current_url"]}

Complete content of $urls:

Smarty_Variable Object (3)
->value = Array (19)
  base_url => "http://www.fietsgoed.local/"
  current_url => "http://www.fietsgoed.local/content/49..."
  shop_domain_url => "http://www.fietsgoed.local"
  img_ps_url => "http://www.fietsgoed.local/img/"
  img_cat_url => "http://www.fietsgoed.local/img/c/"
  img_lang_url => "http://www.fietsgoed.local/img/l/"
  img_prod_url => "http://www.fietsgoed.local/img/p/"
  img_manu_url => "http://www.fietsgoed.local/img/m/"
  img_sup_url => "http://www.fietsgoed.local/img/su/"
  img_ship_url => "http://www.fietsgoed.local/img/s/"
  img_store_url => "http://www.fietsgoed.local/img/st/"
  img_col_url => "http://www.fietsgoed.local/img/co/"
  img_url => "http://www.fietsgoed.local/themes/fie..."
  css_url => "http://www.fietsgoed.local/themes/fie..."
  js_url => "http://www.fietsgoed.local/themes/fie..."
  pic_url => "http://www.fietsgoed.local/upload/"
  pages => Array (32)
    address => "http://www.fietsgoed.local/adres"
    addresses => "http://www.fietsgoed.local/adressen"
    authentication => "http://www.fietsgoed.local/login"
    cart => "http://www.fietsgoed.local/winkelmandje"
    category => "http://www.fietsgoed.local/index.php?..."
    cms => "http://www.fietsgoed.local/index.php?..."
    contact => "http://www.fietsgoed.local/contact-ons"
    discount => "http://www.fietsgoed.local/korting"
    guest_tracking => "http://www.fietsgoed.local/bestelling..."
    history => "http://www.fietsgoed.local/bestelover..."
    identity => "http://www.fietsgoed.local/identiteit"
    index => "http://www.fietsgoed.local/"
    my_account => "http://www.fietsgoed.local/mijn-account"
    order_confirmation => "http://www.fietsgoed.local/order-beve..."
    order_detail => "http://www.fietsgoed.local/index.php?..."
    order_follow => "http://www.fietsgoed.local/bestelling..."
    order => "http://www.fietsgoed.local/bestelling"
    order_return => "http://www.fietsgoed.local/index.php?..."
    order_slip => "http://www.fietsgoed.local/bestel-bon"
    pagenotfound => "http://www.fietsgoed.local/pagina-nie..."
    password => "http://www.fietsgoed.local/wachtwoord..."
    pdf_invoice => "http://www.fietsgoed.local/index.php?..."
    pdf_order_return => "http://www.fietsgoed.local/index.php?..."
    pdf_order_slip => "http://www.fietsgoed.local/index.php?..."
    prices_drop => "http://www.fietsgoed.local/aanbiedingen"
    product => "http://www.fietsgoed.local/index.php?..."
    search => "http://www.fietsgoed.local/zoeken"
    sitemap => "http://www.fietsgoed.local/sitemap"
    stores => "http://www.fietsgoed.local/winkels"
    supplier => "http://www.fietsgoed.local/leverancier"
    register => "http://www.fietsgoed.local/login?crea..."
    order_login => "http://www.fietsgoed.local/bestelling..."
  theme_assets => "/themes/fietsgoed/assets/"
  actions => Array (1)
    logout => "http://www.fietsgoed.local/?mylogout="
->nocache = false
->scope = "file:cms/page.tpl"

 

Link to comment
Share on other sites

Hi sturan, I was able to get the list and using one of parameters in the debug listing the created this if statement but the same is not working. Can u suggest me a proper statement for url validation? This are multiple variants of if statement i tried but none are working. Another problem is iam using a SEO module which wipes ids to make them google friendly anyways i gave it a tried but not working still.

 

 {if $current_url == 'cakes'} 
                {hook h='Below'}
                {/if} 

 

{if $id_category == '14'}

  {hook h='Below'}
                {/if} 

 

if(isset($_GET['cakes']))

 {hook h='Below'}
                {/if} 

Link to comment
Share on other sites

Hey thanks sturan i figured it out myself✌️ finally thanks for your help😃 I used this code to restrict my hook to particular categories finally relief

 

{if $category.id =="120" || $category.id =="123" } 
                {hook h='Below'}
                {/if} 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...