View previous topic :: View next topic |
Author |
Message |
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Thu Mar 01, 2018 11:36 pm Post subject: |
|
|
Why so complicated?
Code: | {$SITE_URL|strstr:"//"} |
|
|
Back to top |
|
bsmither Smarty Elite
Joined: 20 Dec 2011 Posts: 322 Location: West Coast
|
Posted: Fri Mar 02, 2018 1:15 am Post subject: |
|
|
Not that I was thinking of this earlier, but I choose Smarty modifiers first on the possibility there may be security policies in place. |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Fri Mar 02, 2018 9:25 am Post subject: |
|
|
Point. |
|
Back to top |
|
emmanouel Smarty Rookie
Joined: 02 Nov 2017 Posts: 7
|
Posted: Fri Mar 02, 2018 4:43 pm Post subject: |
|
|
Hello, thank your for you reply.
To get in a line,
1. First I found inside head.tpl file the lines of code which cause the problem
(example) <script type="text/javascript" src="{$baseURL}/assets/javascript/jquery/jquery.min.js"></script>
2. So,the problem is caused by the {$baseURL}. My problem here is that I can't find,no matter how long I spend where is declared.
3. The given code seems to work fine and really I appriciate it.
but to avoid a number of replacements where is declared the {$baseURL} ?
Thanks |
|
Back to top |
|
bsmither Smarty Elite
Joined: 20 Dec 2011 Posts: 322 Location: West Coast
|
Posted: Fri Mar 02, 2018 7:18 pm Post subject: |
|
|
It could be anywhere in your PHP scripts.
Code: | $Smarty->assign('baseURL',"whatever"); |
If you can't find it, then try finding the final: Code: | $Smarty->display("name_of_master_template"); |
Just above that, add a new line: Code: | $tmpBaseURL = $Smarty->getTemplateVars('baseURL');
$tmpBaseURL = somefunction($tmpBaseURL); // strip http|https
$Smarty->assign('baseURL',$tmpBaseURL); |
|
|
Back to top |
|
emmanouel Smarty Rookie
Joined: 02 Nov 2017 Posts: 7
|
Posted: Fri Mar 02, 2018 9:20 pm Post subject: |
|
|
1. From your experience, files inside smarty,includes,themes, index, config??
Debugger says smarty root scope
2. The alternative solution you gave me has a 'somefunction', which is?' |
|
Back to top |
|
bsmither Smarty Elite
Joined: 20 Dec 2011 Posts: 322 Location: West Coast
|
Posted: Fri Mar 02, 2018 10:08 pm Post subject: |
|
|
1. I use a program to search through files. It is very fast.
If index.php is more than 50 lines, it might be at the end of that file. Otherwise, maybe a controller file or class method in the /includes/ folder.
2. Whatever it takes. Try: Code: | $tmpBaseURL = strstr($tmpBaseURL, "//"); |
|
|
Back to top |
|
emmanouel Smarty Rookie
Joined: 02 Nov 2017 Posts: 7
|
Posted: Sun Mar 04, 2018 12:51 pm Post subject: |
|
|
Fianlly I brought off to debug the site!
It was assinged to another variable, $siteurl,which was assinged array() with settings etc...
By the way, the given code didn't work, I put it inside index.php before the line code Code: |
$Smarty->display("index.tpl"); |
Any considerations in order to got understand why thw website was collapsed?
Many thanks
Emmanouel |
|
Back to top |
|
bsmither Smarty Elite
Joined: 20 Dec 2011 Posts: 322 Location: West Coast
|
Posted: Sun Mar 04, 2018 9:09 pm Post subject: |
|
|
I do not understand your use of the word 'collapsed'. |
|
Back to top |
|
emmanouel Smarty Rookie
Joined: 02 Nov 2017 Posts: 7
|
Posted: Wed Mar 14, 2018 10:04 pm Post subject: |
|
|
Sorry for the delay.
I mean the site breaks, do not load pages. At this moment I can't try again the code to see what was the http error to refer it. It's ok if there is no suggestions.
Thank you for your help anyway |
|
Back to top |
|
bsmither Smarty Elite
Joined: 20 Dec 2011 Posts: 322 Location: West Coast
|
Posted: Thu Mar 15, 2018 1:05 am Post subject: |
|
|
According to your initial post, the Smarty object is named $smarty, not $Smarty.
If you used $Smarty, then PHP probably crashed because $Smarty is a non-object.
If your code uses $smarty (lower-case), then these experiments should also use $smarty->display("index.tpl"); (lower-case) but not $Smarty->display("index.tpl"); (capitalized). |
|
Back to top |
|
emmanouel Smarty Rookie
Joined: 02 Nov 2017 Posts: 7
|
Posted: Mon Mar 19, 2018 12:40 am Post subject: |
|
|
Well, it seems that you have right! Finally, that was the reason. Now i'llnever forget such kind of mistakes... .
Thanks again |
|
Back to top |
|
|