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.052 seconds

I'm playing around with the new mvc and the FORK feature is FANTASTIC!!! it's saving me a lot of time! you are doing a very good job!!

Tomaselli (Forum)  

Get Started