Smarty : How to delete part of url? - smarty

I'm displaying current url with :
https://mywebsite.com/{$smarty.server.SCRIPT_URL}
So i obtain : https://mywebsite.com/shop1/mycategory/myproduct/ or https://mywebsite.com/shop2/mycategory/myproduct/ depending on the shop i'm connected on.
I need to delete the /shop1 or /shop2 in the url
How to do that ? Any idea ?
Thank you !

https://mywebsite.com/{$smarty.server.SCRIPT_URL|replace:'shop1/':''|replace:'shop2/':''}

Related

How to get domain name from PL/SQL in Apex?

I have an apex application hosted at a certain address which not very user friendly. Let's say : aaze_a442.com
I have another domain (which is user friendly) that redirects to the aaze_a442.com let's say : niceexample.com such that APEX application will be transparently accessed from niceexample.com
The redirection works nicely.
I'm trying to get the nice domain name from PL/SQL. As a result I'm expecting to get : niceexample.com
I'm using the following query :
SELECT SYS_CONTEXT('USERENV','SERVER_HOST') FROM dual;
But it doesn't return niceexample.com, it returns instead aaze_a442
Does anyone know how to get the domain instead of the host name please ?
Thanks
Got the Answer :
OWA_UTIL.get_cgi_env ('REQUEST_PROTOCOL') || '://' || OWA_UTIL.get_cgi_env ('HTTP_HOST')
returns : https://niceexample.com

How to get friendly URL variable in Prestashop template?

I am looking help about smarty global variables. How to get friendly URL variable for using it in smarty template of the Prestashop.
I have found this {$smarty.server.REQUEST_URI} , but I got only full URL.
It looks like:
/en/our-products/73-lighted-mirror-tokyo-70-x-32.html
I need to get only 73-lighted-mirror-tokyo-70-x-32 sting.
Help, please.
You can also use the getUrlRewriteInformations() function from the Product class in PrestaShop.
It can return the information about the URL Rewrites of any product using the following line of code:
$rewrite_info = Product::getUrlRewriteInformations($id_product);
Great, it was help full. I have found the solution for get current product slug on the product page of the Prestashop:
Source URL: /en/our-products/2-backlit-mirror-rectangle-20-x-28.html
{assign var="var" value=$smarty.server.REQUEST_URI}
{assign var="output" value=$var|substr:0:($var|strpos:"."+0)}
{assign var=slug value=$output|substr:($output|strpos:"/"+17)}
{$slug}
Slug: 2-backlit-mirror-rectangle-20-x-28

Laravel blade adding a class for a particular uri using a wildcard

Im trying to make a menu but some of my pages have custom uris based on a random string
like /page/show/hn87qh208h2u3gf8o7g87
I've tried a few various implementations, like the one below, but its not working. Has anyone come across this before?
I'm lead to believe from searching that the wildcard would work within blade like it does in php, but its seems not, it could be because i'm using the latest version and its been removed/changed maybe?
{{ Request::is('/page/show/*') ? 'active' : '' }}
Provide a name to your particular route as below:
Suppose you have route as below:
Route::get('page/show/{id}', 'Path\To\Your\Controller\Name#methodName');
Rewrite it as :
Route::get('page/show/{id}', ['as' => 'show-page','uses' => 'Path\To\Your\Controller\Name#methodName'])
OR
Route::get('page/show/{id}', 'Path\To\Your\Controller\Name#methodName')->nane('show-page');
In view file change the code as below:
{{ Request::route()->getName() == 'show-page' ? 'active' : '' }}
I hope may this will help you.

How to generate Laravel Link with anchor

I use Laravel URL::Route for link pages, And I passed query string like following code, but how to add anchor tag for this?
eg: myproject.local/projects?week_ending=value#anchor
How to do that #anchor part with URL::Route? thank you
URL::Route('projects', array('week_ending'=>$week_end_day))
The most obvious way for that will be:
URL::Route('projects', array('week_ending'=>$week_end_day)) . '#anchor'

one codeigniter controller named site needs to handle multiple domains

Got a controller in codeigniter who handles different sub sites.
site/index/1 fetches content for subsite A
site/index/2 fetches content for subsite B
Now we decided to register domain names for these sub sites.
so what we need:
http://www.subsite1.com -> default controller should be site/index/1
without the site/index/1 in the URI.
http://www.subsite2.com -> default controller should be site/index/2
without the site/index/2 in the URI.
I fiddled and tried to play with routes.php but getting nowhere..
Can somebody point me in the right direction?
in your routes.php file you need to set this:
$route['default_controller'] = ($_SERVER['SERVER_NAME'] == 'http://www.subsite1.com' ? "site/index/1" : "site/index/2");
and if your trying to force it somewhere when some weird url is types in:
$route['404_override'] = ($_SERVER['SERVER_NAME'] == 'http://www.subsite1.com' ? "site/index/1" : "site/index/2");
and for the second one just switch it to 2

Resources