9
votes
Pass var to jQuery script
After this question was originally answered, Joomla introduced in version 3.5 another way of passing variables to javascript, using the addScriptOptions() method of the Joomla Document class. So I'm ...
3
votes
Accepted
SQL WHERE clause with a variable (current article ID)
Your code contains several errors, including a syntax error. You should use an IDE with proper code completion and signature hints (any modern IDE should be able to do that).
$query->select('value'...
3
votes
How do I create a new PHP variable for a blog override from the result of JDatabase join query?
Your code contains a few errors, which is why you're getting a white page.
1)
$db->('f.featured_up') needs to be replaced with $db->quoteName('f.featured_up')
2)
You're missing a comma (,) after ...
2
votes
Accepted
pass on value of id in another variable
If I understand well your question and code, you should change:
Factory::getApplication()->input->get('id');
To this:
Factory::getApplication()->input->get('v_id', 0, 'int');
Check ...
1
vote
Accepted
How do I create a new PHP variable for a blog override from the result of JDatabase join query?
Firstly: the reason for the white page errors was that I was putting the code into the wrong file. Instead of adding it to blog_item.php it should be in blog.php. It worked once I'd moved the code.
...
1
vote
Accepted
Session variable from a module is only accessible from the template after refresh
For this exact issue the solution was to avoid the things that are not working.
So instead of trying to get the variable from the module to the template in my php I created a html variable "--...
1
vote
How do I carry a Joomla article title and its link across from an article layout into a module's helper?
You can use Factory->getDocument title and link.
use Joomla\CMS\Factory;
$doc = Factory::getDocument();
$title = $doc->getTitle();
$url = $doc->getLink();
1
vote
Where do I define custom global variables in my Joomla project?
See the documentation for Adding Configuration Parameters.
This then makes your configuration parameters available via the params, these can be obtained anywhere using the JComponentHelper class or ...
1
vote
How to SET a user-defined MySQL variable and increment it to produce ranking values with JDatabaseQuery?
Joomla syntax aside, let's start by explaining your desired action.
You want to apply an incrementing counter to a specific column for all rows in the table. This is a very reasonable and common ...
1
vote
Params in Custom Component List View
Addendum:
OP wants the menu item params accessible in the view, but he tries to override the component params var ($this->params) with the menu item params object/class. Which is unnecessary ...
1
vote
Params in Custom Component List View
You are getting $params from $state
$state = $this->get('State');
This means the state must have $params populated in your model. Check if you are populating the $state with $params in your ...
1
vote
Accepted
Params in Custom Component List View
It looks like you are trying to get the menu parameters for your current active menu. Try the following code, this hasn't been tested, I am giving you this reference from memory.
$app = JFactory::...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
variable × 21php × 9
joomla-3.x × 7
mysql × 3
custom-module × 3
module × 2
templates × 2
custom-component × 2
database × 2
jdatabase × 2
menu-parameters × 2
articles × 1
extensions × 1
javascript × 1
user × 1
joomla-api × 1
jquery × 1
menu-item × 1
custom-field × 1
k2 × 1
security × 1
sql × 1
joomla-3.9 × 1
fix-my-code × 1
session × 1