Setting Global Variables

6 posts by 2 authors in: Forums > CMS Builder
Last Post: March 14, 2017   (RSS)

Hi All,

OK I’m feeling silly.

I’m trying to set the global variable newGlob to a value of 30 using  <?php $GLOBALS['newGlob'] = 30 ?> on a page that I’m loading.

I had thought that once set, a global variable could be used on other pages and by CMSB

I guess I just don’t understand the process, since it doesn’t seem to do the job and I can’t echo newGlob on any other page.

Any thoughts?

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By ross - March 13, 2017

Hi Jerry

Thanks for posting

The $GLOBAL array is only going to be set for the page you are currently on.

To use the same values on different pages, you can look at the $SESSION variable.

Another option could be looking at storing the values in your database.

Do either of those options seem like they'd work?

Let me know what you think.

-----------------------------------------------------------
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/

By ross - March 13, 2017

Sounds good Jerry.

Keep me up to date with how you are making 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/

Hi Ross,

I found this tutorial which made it simple to understand.

https://www.w3schools.com/php/php_sessions.asp

Thanks for pointing me in the right direction.

Jerry

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By ross - March 14, 2017

Great Jerry

I like using w3schools!

-----------------------------------------------------------
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/