0

I have a series of if:elseif statements that compare $_GET Variables using "{exp:parameters:get name='price'}"=="<?php echo $myVariableHere; ?>". This is filtering out some of the entries so that they don't show, this works perfectly.

NOTE: $myVariableHere is coming from <?php $myVariableHere="{categories show_group='#'}{category_name}{/categories}"; ?>

The exception is my 'region' variable, because it uses child categories. I tried to call them this way, <?php $myVariableHere="array{categories show_group='#' backspace='2'}'{category_name}', {/categories}"; ?>

The problem is that even though it appears to print to my page correctly ('Canada', 'Foo', 'Bar') it does not have separate keys in the array, they are all part of the 1st key. So I can not call on the categories separately to use them in my comparison.

In the end, I need to compare the $_GET VARIABLE of ?region=Canada to the entries categories in that group ('Canada' with a child of 'Foo' with a child of 'Bar').

Looking forward to any suggestions. NOTE: I have been using gw:categories in places.

2
  • I guess you had a look at low seg2cat for getting category info from URL segments? – Jérôme Coupé Jul 16 '13 at 9:05
  • Thanks, sorry I didn't add the pre_code quotes in question, now added above. I'm using segments to call the entries within the channel entry, the $_GET Variables are created on the fly at the front end by the user selecting from a menu and the categories need the flexibility to be added in the entries also on the fly. Low seg2cat may not work with changing menu constantly changing menu options on the front end. Let me know if I am wrong. I have done a lot of work to now and changing it 'completely' may hurt my brain, but I do NEED to get it working, so... anything it worth a try. – JayB Jul 16 '13 at 13:55
0

Maybe im missing something, but can't you just use the php function explode to break ('Canada', 'Foo', 'Bar') into an array?

1
  • Yes, it really can be that simple. I didn't see the forest through the trees. THANK YOU! – JayB Jul 18 '13 at 19:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.