| ||||||||||
![]() |
Shopping cart software Solutions for online shops and malls | |||||||||
![]() |
![]() |
|
X-Cart Home | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
spitting variables | |||
![]() |
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
![]() Hi
Im trying to find a way that i can split up each part of the $location[position] variable into seperate variables. ie.. if $location[position] is "home.php home.php?cat=..." $var1 home.php $var2 home.php?cat=... etc etc thank you all |
|||||||
#2
|
|||||||||
|
|||||||||
![]() In location.tpl location is assign through {foreach} loop. You can use it to do this just place your code inside it
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
#3
|
|||||||
|
|||||||
![]() Thanks for that however that doesnt seem to do what im trying to acheive.
{foreach from=$location[position] item=foo} {$foo} {/foreach} looks good & lists the array however it doesnt break it down, i need to try to get each component of the $location[position] array into seperate variables ie .... var1 home.php var2 cat.php etc etc no matter the length of the array each component will be in a seperate variable, sorry i hope that makes sense. |
|||||||
#4
|
|||||||||
|
|||||||||
![]() What I meant is that this loop reads each location and adds to path. You can include in this loop code that adds number to 'var' with time and assigns $foo to var1, var2.....
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
#5
|
|||||||
|
|||||||
![]() Sorry Im not sure if thats right.
An example would be if Ive gone from home page to category 1 and subcat 1 then the $location[position] would equal home.php category1 subcat 1 .. etc i assume thats in an array $location[position] if i run the loop in the last post & display each element of the array i get {$foo[0]} gives me h - i need home.php {$foo[1]} gives me o - i need category 1 etc ... would you happen to have an example of what you mean please ? thank you |
|||||||
#6
|
|||||||||
|
|||||||||
![]() I am away from my desk at the moment I'll check on this later
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
#7
|
|||||||||
|
|||||||||
![]() I am getting a litle confused here. Why do you need to assign them to new variables? You can PM me if you want to.
All locations are already in $location array so you just need to use it properly. $location array contains arrays (0, 1, 2, 3...) for each location and each of these arrays contains name (0) and location (1). If you are on home page $location will have one array (0) and this array will have record 0 - Home and record 1 - home.php so $location[0].0 will give you "Home" and $location[0].1 will give you "home.php". If you are in category $location will have all of the above + one more array (1) which will have record 0 - cat name and record - 1 home.php?cat= so you can call it like this $location[1].0 will give you "cat name" and $location[1].1 will give you "home.php?cat="
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
#8
|
|||||||||
|
|||||||||
![]() Try this:
Code:
(removed the [position])
__________________
Richard Williams Rogue Wave Limited Initial Inventory Imports Daily Inventory Updates Daily Inventory Reports Drop Ship Support Order Export to Shipper/Supplier Shopping Feeds That Work Programming for X-Cart richard@roguewavelimited.com http://www.roguewavelimited.com |
|||||||||
#9
|
|||||||||
|
|||||||||
![]() You are welcome Andy. Glad to help
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
|
|||
X-Cart forums © 2001-2020
|