How to pass URL parameters to a joomla module - joomla

I have my own nice link http://www.link.com/sometext, now I would "enhance" this having the opportunity to write something like http://www.link.com/sometext?parameters=myParam cause I need to send a parameters to the article called by sometext.
Can I do something like that??? How can I pass parameters through the URL???? How can i get it's value?
Regards

You should use the standard Joomla way to retrieve GET/POST requests. This link should get you started:
http://docs.joomla.org/Retrieving_data_from_GET_and_POST_requests
$address = JRequest::getVar('address');
EDIT - just saw your other comment. To use PHP inside article, try something like Sourcerer: http://extensions.joomla.org/extensions/edition/custom-code-in-content/5051

Related

how to pass the id as an argument in the laravel link

I am new at laravel and i am using the follow syntax to call the controller directly from the url. Now I dont know how to pass the argument in these link. Please needed your help for these.
Route::get('/pagelink', 'YourController#callMeDirectlyFromUrl');
And in the link i have written these:
Link name/Embedded Button
Now how to pass the id in these code.
you can do it like this :
Route::get('/pagelink/{id}', 'YourController#callMeDirectlyFromUrl');
Link name/Embedded Button

Laravel URLs with query parameters

I want to implement a link in my application, but instead of it following this format:
/origin/{number}
I want it to look like this:
/origin=number
How do I implement a route successfully which will understand this link format? Surely Laravel is flexible enough to not only be able to parse slash-based URLs?
This should work:
Route::get('/origin={number}', ...);

How to get the base url of a specific store view in a static block?

I know that in a .phtml file you do it like this for example:
<?php echo $this->helper('derco_core')->getStoreUrl('dcmotosesp')?>
I want to do the same thing inside a static block. Thanks in advance.
There is no 'clean' way of getting an url for a specific store using shortcodes ({{store url}}).
...because the store shortcode handler end like this (see Mage_Core_Model_Email_Template_Filter::storeDirective()):
return Mage::app()->getStore(Mage::getDesign()->getStore())->getUrl($path, $params);
This means that the store cannot be passed as a parameter.
The following might work but it's a bit ugly. The idea is to send the parameter ___store through $_GET telling Magento to switch to a specific store.
TEST LINK
(replace 'store_code_here' with your specific store code).
An other option would be to extend the method mentioned above and allow it to receive a store_code parameter.

passing data to another controller

I need to pass product Id from cart to custom controller, for example
http://**/catalogsearch/filter/results?product={ID}
I dont have a clue how to pass data like that using magento helpers etc
Thanks
I am assuming from your question that you are redirecting from one controller to another and would like to pass query parameters along?
The syntax would be:
$params = array('key' => 'value');
$this->_redirect('frontname/controlller/action', array('_query' => $params));
EDIT
To answer the question in the comment on how to get these parameters from a template:
First off, I would advise not to do this, you should be recieving parameters in the controller. So, your custom controller should be responsible for receiving any parameters.
Regardless, the code in either situation is the same:
All parameters…
$this->getRequest()->getParams()
Single parameter…
$this->getRequest()->getParam('parameter_name')

Using and hiding default class

This is my first time getting my hands dirty with CI so I'm getting a little confused.
I'm wanting to accomplish a couple things with my question. First of all, I'd like to always use the default controller without having it to appear in the url. For example, I created a new class named after my site (Example.php) and that works fine. However, if I want to call the search function in my controller I then have to go to example.com/index.php/example/search/.
The second thing I want to accomplish is when I run a search I'll get a nice looking url like so: example.com/search/This+is+a+search (I haven't gotten to removing the index.php portion but I know to use a htaccess). I'm not worried about the actual mechanics of the search, just that I'd like to format the url in this way.
I originally experimented with using a Search class but that found that it doesn't allow me put the search in the url because the second parameter should be a function and not the extra stuff.
Thanks for any help.
In application/config/routes.php file add $route to redirect everything to your controller.
Something like this:
$route['([^\/]+)'] = 'content/index/$1';
$route['([^\/]+)\/([^\/]+)'] = 'content/index/$1/$2';
This will redirect urls like example.com/A and example.com/A/B to a controller named content. Parameters A and B will be passed to method index.

Resources