Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Passing a SESSION variable into a query 11 Apr 2016 14:05 #13907

  • MorganL
  • MorganL's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
This is a strange one, but I need to call a session variable in a query.. this is actually easy enough EXCEPT there is a chance that I need to regenerate that variable (using a function) before the model is called (i,e if someone visits a certain page out of order.. such as boomarked)

At what point can I call a function called (for example) getDistanceVariable and make sure it is fired BEFORE the model is rendered for the display

Does it go in the controller somewhere, in the VIEW.HTML.PHP file etc

Thanks in advance for any assistance
Morgan Leecy MCSE

Novell / Linux
PHP. MYSQL, Apache, node.js
Coldfusion, JQuery, HTML5
Joomla

Please Log in or Create an account to join the conversation.

Passing a SESSION variable into a query 12 Apr 2016 07:36 #13908

You can fork your displayDefault function in VIEW.HTML.PHP.

The generated function starts with:
$this->model		= $model	= $this->getModel();

A couple of lines below there is
$this->items		= $items	= $this->get('Items');

Between those lines add something like (assuming getDistanceVariable returns and int)
$model->addWhere('a.distancevariable='.getDistanceVariable());
The following user(s) said Thank You: admin

Please Log in or Create an account to join the conversation.

Last edit: by Romkabouter.
  • Page:
  • 1
Time to create page: 0.073 seconds

I jumped and started to work on a demo component... but 2 days later this demo component became the real component. I just showed today the end result to my customer and he turned to me and said... "this is more than I expected"... All of this is because Cook did cut about 70% of my work and provided me more ways to improve the usability of the component. The end result was 17 tables all related between than to generate a full dashboard for the travel agents. Thanks for Cook developers for such great tool. This component would not be possible to be done at short time with all the features in it
Griiettner (Forum)  

Get Started