I use smarty and I want to check if my currenty URL contains some value.
Therefore I use the following code, but that does not work.
{if $smarty.server.HTTP_REFERER|strstr:'domain=transfer&sld='}
The full URL;
https://example.com/cart.php?a=add&domain=transfer&sld=value&tld=.com
What am I missing?
Try REQUEST_URI instead of HTTP_REFERER.
This will do it.
Related
I want to send static value through my url from my blade file .But this not working.can you give me the solution
>
> This is link
you have syntax error you can fix by
This is link
here ?rfq=1 this will come under '' this tag as it is string
as your router is defined as this
Route::get('/user-login/{email}/{password}', 'UserController#user_login')->name('users.user_login');
you should use route name and pass the data like this
This is link
then if you need to pass you can use like this
This is link
this will generate url like localhost:8000/user-login/example#mail.com/1234?rfq=1"
ref link https://laravel.com/docs/8.x/helpers#method-route
If you are using {} in your route(route parameter method) then no need to have '?' in your URL. If you need 127.0.0.1:8000/user-login?rfq=1 as your URL then create route without route parameters as
Route::get('/user-login,'UserController#user_login')->name('users.user_login');
I need to retrieve the $_GET data from the URL in a smarty .tpl file. The specific $_GET I need to retrieve is in a loop. I need to use the example below but with a variable for page.
{* display value of page from URL ($_GET) http://www.example.com/index.php?page=foo *}
{$smarty.get.page}
This should work:
{assign var="foo" value="assign whatever you want"}
{$smarty.get.$foo}
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.
I got stack on this in Codeigniter route, What do I want is to remove the function_name in url to be able to have a short url.
Here is the example want to have in my url
http://mysite.com/controller_name/function_name/id
to this
http://mysite.com/controller_name/id
Is there any other solution to have this if cannot be done in route? thanks!
If the above didn't work you could try:
$route['controller_name/(:num)'] = 'controller_name/lookup_function/$1';
Not much different from what was already suggested other than a hard coded controller name.
You can probably do it by trying:
$route['([a-z]+)/(\d+)'] = "$1/method/$2";
That is if you don't need to change the name of your method.
I am using CodeIgniter. In my script, I am changing $config['index_page'] in config.php file as per the user's reponse, i.e, dynamic index_page is used. In order to get it work, I have changed the $config['uri_protocol'] value to "AUTO".
Everything is working fine except when the case comes like : domain.com/index_page/auth/register?testvar=1
It's not accepting the get variables and "PAGE NOT FOUND" error is there. I have tried several things already discussed here, but they involve changing the uri_protocol to "PATH_INFO" that I can't change as the site stops working. It requires "REQUEST_URI" to work properly which is exactly the case with "AUTO" setting.
So is there, any way to get it working???
Any help would be appreciated.
Have a look at this answer: Handling question mark in url in codeigniter it will require you to override the core URI class whenever you are accepting QUERY_STRING and inject your logic there.
Have you read this: http://codeigniter.com/user_guide/general/urls.html ?
You pass vars like this:
domain.com/index_page/auth/register/1
The first segment represents the
controller class that should be
invoked.
The second segment represents
the class function, or method, that
should be called.
The third, and any
additional segments, represent the ID
and any variables that will be passed
to the controller.
Also you can do it your way, read the reference. But than why to use a framework at all?
I've done the same thing in my project and I got the url like
mydomain.com/search/?name=Arun+David&age=23
To achieve this,
In config file set
$config['uri_protocol']='PATH_INFO'; or $config['uri_protocol']='ORIG_PATH_INFO';
if PATH_INFO is not working try using ORIG_PATH_INFO. For me in localhost PATH_INFO is woking but not ORIG_PATH_INFO but while uploading it in server ORIG_PATH_INFO in working but not PATH_INFO.
and in your search controller's constructer add
parse_str($_SERVER['QUERY_STRING'],$_GET);
then you can use $_GET['name'] and $_GET['age'] in your code!.!. :-)