More Issues With selectedCategoryNum

5 posts by 2 authors in: Forums > CMS Builder
Last Post: March 29, 2010   (RSS)

Re: [Perchpole] More Issues With selectedCategoryNum

By Chris - March 29, 2010

Hi Perch,

Wow, great find! This certainly does make a case for this feature being fixed immediately. So, here it is!

The next version of CMS Builder will have this fix built in, but if you'd like, you can make the change right now to your copy:

Open up cmsAdmin/lib/viewer_functions.php and change this line:

if (!@$options['selectedCategoryNum']) {

...to this:

if (!array_key_exists('selectedCategoryNum', $options)) {

Now you can explicitly state in your viewers:

'selectedCategoryNum' => 0,

...which will avoid the automatic behaviour of using getLastNumberInUrl.

I hope this helps! Please let me know if you have any questions.
All the best,
Chris

Re: [chris] More Issues With selectedCategoryNum

By Perchpole - March 29, 2010

Hi, Chris -

Thanks for your input. However, I'm not entirely sure this is a fix - certainly not the one I'm looking for!

As far as I can tell, your update simply defines a default categoryNum - in any eventuality.

'selectedCategoryNum' => x,

In my example, however...

www.mysite.com/index.php?category=3&type=diesel engine

...I want the category to be 3, as defined by the URL, regardless of any other factor.


If there is no category defined in the URL...

www.mysite.com/index.php?type=diesel engine

...then it can default to the setting in the page viewer...

'selectedCategoryNum' => x,

Surely that's the only way to make the category structure dynamic and consistent?

[:/]

Perchpole

Re: [Perchpole] More Issues With selectedCategoryNum

By Chris - March 29, 2010

Hi Perchpole,

Sorry, I thought this issue was more related to the other thread than it is.

Does this work?

'selectedCategoryNum' => @$_REQUEST['category'],

I hope this helps. Please let me know if you have any questions.
All the best,
Chris

Re: [chris] More Issues With selectedCategoryNum

By Perchpole - March 29, 2010

Hi, Chris -

It actually works (best) like this...

$homeCategoryNum = 1;
$selectedCategoryNum = @$_REQUEST['category'];
if (!$selectedCategoryNum) { $selectedCategoryNum = $homeCategoryNum; }

Then...

'selectedCategoryNum' => $selectedCategoryNum,

Deffinitely getting somewhere!

:0)

Perch