X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Check for url paramater existance (https://forum.x-cart.com/showthread.php?t=34697)

chamberinternet 10-18-2007 02:32 AM

Check for url paramater existance
 
Hello ..

Wondering if there is a way in smarty to find out if a certain parameter exists in the url's query string?

e.g: current url - product.php?productid=16137&cat=0&page=1&featured
and I need to check if the parameter 'featured' exists ...

{if $php_url.query_string eq "featured"} ... {/if} doesn't seem to work, because that outputs the whole query string ...

Can anyone help ?

Thanks

Shafiq :sK

PhilJ 10-18-2007 02:57 AM

Re: Check for url paramater existance
 
Try...
Code:

{if $php_url.query_string eq "productid=`$product.productid`&cat=0&page=1&featured"}
THIS IS A FEATURED PRODUCT!
{/if}


chamberinternet 10-18-2007 03:07 AM

Re: Check for url paramater existance
 
Thats Great ... Thanks Phil ..

Regards

Shafiq :sK

dpm 10-29-2007 06:51 AM

Re: Check for url paramater existance
 
IS there a way to read just part of the query string? Like an instring function of some sort? I need to look for "mode=checkout" within the query string, but there may be more parameters then that.

Any help is appreciated.

-dpm

PhilJ 10-29-2007 06:53 AM

Re: Check for url paramater existance
 
Code:

{if $mode eq "checkout"} ... {/if}

dpm 10-29-2007 07:30 AM

Re: Check for url paramater existance
 
Hi Phil...

Thanks for your quick response... I should have been a little more clear... I have 2 options:

1. cart.php?mode=checkout
2. cart.php?mode=checkout&signup=1

If the signup=1 is present then I show the user a hidden div tag where they can signup for a membership.

I tried this but it didnt work.

{if $signup eq "1"} ... {/if}
Any ideas?

Many Thanks,
-dpm


All times are GMT -8. The time now is 07:27 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.