Passing variable in URL results in no CMS access

12 posts by 7 authors in: Forums > CMS Builder
Last Post: December 5, 2009   (RSS)

By dwellingproductions - July 16, 2009

Hello all!

OK. The issue we're having is that with the menu we're using for a new site in development, it requires a variable to be passed via the URL in order to tell it which section to have open. So for instance, if it gets the variable number which corresponds to the ABOUT section, when it arrives at the clicked page, the ABOUT section in the menu will be open to reveal the submenu items/pages.

In theory, and in early tests, this seemed like it would work well. However, for some reason, passing this variable in the URL denys us access to the CMS.

For example, the children's ministry page should look like this: http://www.praisecenterchurch.org/dev/children.php

But, when passing the needed variable for the menu "?menu=2", we lost all database drawn info as seen here: http://www.praisecenterchurch.org/dev/children.php?menu=2

Obviously, you will now notice the "Coming soon..." text which appears when no database content is present. Also, you will note that the page title is incomplete, since a portion of the page title is drawn from a CMS file.



So, what we need is a way to pass the variable in the URL and have the database content show up on the page.
I sure hope there's a way to do this, otherwise I may be "up a creek". :-)

Thanks, in advance, for any assistance.

Jeremy
---------------------------

Dwelling Productions

www.dwellingproductions.com

Re: [dwelling] Passing variable in URL results in no CMS access

By ross - July 17, 2009

Hi Jeremy

Thanks for posting!

When you have a variable like that in the URL, CMS Builder actually tries to do a search for it. Basically, it will try and find all your records that the menu field set to 2. Of course, you don't have a menu field so it's breaking things.

The solution here will be to add the following to your viewer code:

'allowSearch' => '0',

That will tell CMS Builder to ignore what you have in the URL. Give it a shot and let me know how you make out :).
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

Re: [dwelling] Passing variable in URL results in no CMS access

By Dave - July 17, 2009

Hi Jeremy,

For detail viewers it also uses the number in the url to know which record to load. If you have a single record section (such as about us, etc) try removing this line:

'where' => whereRecordNumberInUrl(1),

If you remove that line it will just return the first record in the database, which for single record sections should be fine.

Hope that helps, let me know if that works for you. If it doesn't, feel free to attach the children.php file to this thread and I can take a look for you.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Passing variable in URL results in no CMS access

By dwellingproductions - July 17, 2009

Thank you Dave!!! :-)

That did the trick! I can't tell you how much I appreciate your response and assistance (as well as Donna's). Looks like I may meet my deadline after all. :-)

You guys are the best! Have a great weekend!

Jeremy
---------------------------

Dwelling Productions

www.dwellingproductions.com

Re: [dwelling] Passing variable in URL results in no CMS access

By cricket7475 - October 9, 2009

HI - I'm having an identical problem...

Here's the background for my issue:

1. It's a news page where the detail of the news story is in the right column, and a list of up to 10 news stories is in the left column, all populated from the same table.
2. The newsdetail.php page i created includes links back to the CMS for all the navigation menus, logo, footer content & links, etc.
3. When I click on the first article, the page loads beautifully - all the menus appear as well as all the footer links. The URL ends with a '1'.
4. When I click on the second news item everything breaks. No menus, an error where the logo should be, no footer content, etc. The URL ends with a '2'.

Changing the number on the end to a 1 or 0 loads the first news story and everything else on the page wonderfully.

Changing the number on the end of the URL to anything other than 1 or 0 results in a 'mis-loaded' page. The correct article shows, but none of my menus or footer content loads (essentially nothing else from the CMS loads).

And I need to load records greater than 1 as I'm anticipating many news stories to be populated in this page.

I've tried the 'allowSearch' => '0', also, but that doesn't help either.

That said, any ideas?

I've attached a slightly modified version of the file I'm having issues with. I took out the full URL in the 'require_once' line. Any insight & fixes would be appreciated.

Love the product by the way - using it on 2 company sites already and have 2-3 more planned after I finish up this project.

Thanks.
Attachments:

newsdetail.php 3K

Re: [cricket7475] Passing variable in URL results in no CMS access

By dwellingproductions - October 9, 2009

Hi cricket7475!

Did you try taking out the "where" line? I believe that's what ended up working for us. Just a thought.

Jeremy
---------------------------

Dwelling Productions

www.dwellingproductions.com

Re: [dwelling] Passing variable in URL results in no CMS access

By Chris - October 11, 2009 - edited: October 11, 2009

Hi cricket7475,

Your code is using the number it finds in the URL for two lookups, both for your "common" section and your "news" section:

list($commonRecords, $commonMetaData) = getRecords(array(
'tableName' => 'common',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$commonRecord = @$commonRecords[0]; // get first record

list($newsRecords, $newsMetaData) = getRecords(array(
'tableName' => 'news',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$newsRecord = @$newsRecords[0]; // get first record


Try removing the line in red above.

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

Re: [chris] Passing variable in URL results in no CMS access

By cricket7475 - October 12, 2009

That worked - still learning php and all it's nuances. Thanks for the help!

Re: [cricket7475] Passing variable in URL results in no CMS access

By Chris - October 13, 2009

Glad to be of help! :)
All the best,
Chris