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

Awards for the best Joomla app. This product is gonna win an award for this amazing job. Cook Self Service is the the best application from all over the Joomla universe ! It brings Joomla to a professional level really advanced for developers. It is a real fun to develop with it. The ACL part and security checks implementation are just... so much hours saved. I can now concentrate myself more on the design part and the creative works. Thank you so much. Guys I offer you all my congratulation ! Keep up the works because Joomla is needing it to increase the quality of extensions availables on the JED. I also learned a lot because I can see how to code at the proper place and I found all my answers reading the forum.
lack_hanson (JED)
          

Get Started