jbmd Posted October 12, 2012 Share Posted October 12, 2012 Hi, I would like to add some php code in cms.tpl file ... like echo $_SERVER['REQUEST_URI']; and do not know how. the php coding there is not what I am used to For example when I want to have this: <?php echo $_SERVER['REQUEST_URI']; ?> it showes on pages as normal text The original formatting of php code in cms.tpl is something like this {$cms->content} or this {if isset($cms) && $cms->id != $cgv_id} but when I put this: { echo $_SERVER['REQUEST_URI']; } it results in text again. I am desperate PS: talking about formatting or execution od php code in cms.tpl Link to comment Share on other sites More sharing options...
vekia Posted October 12, 2012 Share Posted October 12, 2012 (edited) Hi, I would like to add some php code in cms.tpl file ... like echo $_SERVER['REQUEST_URI']; and do not know how. the php coding there is not what I am used to For example when I want to have this: <?php echo $_SERVER['REQUEST_URI']; ?> it showes on pages as normal text The original formatting of php code in cms.tpl is something like this {$cms->content} or this {if isset($cms) && $cms->id != $cgv_id} but when I put this: { echo $_SERVER['REQUEST_URI']; } it results in text again. I am desperate PS: talking about formatting or execution od php code in cms.tpl to add php code in smarty template files (tpl) you must add code between {php} {/php} tags, exactly as I show below: {php} echo 'This will be sent to browser'; {/php} you can also do what you want without smarty {php}{/php} tags, how? just look, example attached below displays SERVER_NAME variable from $_SERVER array {$smarty.server.SERVER_NAME} Edited October 12, 2012 by vekia (see edit history) Link to comment Share on other sites More sharing options...
jbmd Posted October 12, 2012 Author Share Posted October 12, 2012 I am afraid none of it worked. Moreover placing one or the other code resulted in disapearing of right column in Prestashop. I just wanted to insert custom code (google map) to one cms page (not a contact form). Link to comment Share on other sites More sharing options...
vekia Posted October 12, 2012 Share Posted October 12, 2012 I am afraid none of it worked. Moreover placing one or the other code resulted in disapearing of right column in Prestashop. I just wanted to insert custom code (google map) to one cms page (not a contact form). give your code and i try to fix it. it is not possible that the code I gave does not work properly, the problem must be with something else Link to comment Share on other sites More sharing options...
jbmd Posted October 12, 2012 Author Share Posted October 12, 2012 after displaying errors - on in php.ini -> no statement was shown. I am giving up I will just put image map instead of google one. I can tell you I work with Joomla and it is such a great system to modify! Link to comment Share on other sites More sharing options...
vekia Posted October 12, 2012 Share Posted October 12, 2012 (edited) after displaying errors - on in php.ini -> no statement was shown. I am giving up I will just put image map instead of google one. I can tell you I work with Joomla and it is such a great system to modify! here is a tutorial about turning on error reporting in prestashop. i don't know what code you use to insert google maps, and how you do it... here is an example code of tpl file with google maps code, which works properly: I've added {$smarty.server} example too <script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAnfs7bKE82qgb3Zc2YyS-oBT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSySz_REpPq-4WZA27OwgbtyR3VcA" type="text/javascript"></script> <div id="map" style="width: 500px; height: 500px"></div> <script type="text/javascript"> var lat=52.17393169256846; var lng=18.8525390625; var zoom=6; function loadgmap() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map")); map.setCenter(new GLatLng(lat, lng), zoom); } } $(document).ready(function() { loadgmap(); }); </script> <a href="http://{$smarty.server.HTTP_HOST}{$smarty.server.REQUEST_URI}">My Site</a> Edited October 12, 2012 by vekia (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now