Passing variable in URL results in no CMS access

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

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: [ross] Passing variable in URL results in no CMS access

Thanks Ross!

This is really interesting. It seems to perfectly solve the issue for the first two sections of the site (About and Events). However, for everything after that, the problem still exists. I've added the prescribed code to every page though.

Is there any reason that you can think of that the other pages would respond differently? The ONLY thing that is different is the variable number being passed. For the first two, this is being passed "?menu=0" and "?menu=1", respectively. Then, the the rest, it is "?menu=2" and so on up to the number 5.

This is especially strange since pretty much ALL the pages have temporarily had the viewer information from the "Children's Ministry" page, and thus all pulling from this database entry. (I did this just to quickly get all the pages in place.) However, information from that database is getting pulled into the "About" and "Events" sections just fine. It's only the later sections that continue to experience the earlier issue.

I'm working on updating each page's viewer code to pull from the appropriate database entry, right now. So far, things are not improving.

I hope you have some insight, because this just has me clueless. :-) I'm supposed to present this to the client this weekend. (I sure hope I make it!) :-)

I look forward to your reply. Thanks again!

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

Dwelling Productions

www.dwellingproductions.com

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

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

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

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: [chris] Passing variable in URL results in no CMS access

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