X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Is there a way to use an external header.php file for the admin section? (https://forum.x-cart.com/showthread.php?t=38780)

AgentBristow 04-02-2008 08:42 AM

Problem using external php file :(
 
I have made a custom header for the admin page of X-Cart. I thought I could use an include tag so that I could store the header file on my website space, meaning I could update it in the future without having to go back and update all of the stores I have worked on. However, when I tried to use the below code in head_admin.tpl it wouldn't work. What am I doing wrong? :(

Any help is appreciated!

<?php include("http://www.mywebsite.com/_header.php"); ?>

AgentBristow 04-02-2008 08:50 AM

Re: Is there a way to use an external header.php file for the admin section?
 
Ok after reading some other threads I figured out how I should be formatting it :

{php}
include('http://www.mywebsite.com/_header.php');
{/php}

Still having issues though - I am now getting the error message>

Warning: include() [function.include]: URL file-access is disabled in the server configuration in /clientdata/clients/d/a/ecommercewebsite.com/www/shop/var/templates_c/%%E2^E20^E20954B4%%head_admin.tpl.php on line 7

Yurij 04-03-2008 12:32 AM

Re: Is there a way to use an external header.php file for the admin section?
 
Quote:

Originally Posted by AgentBristow
Ok after reading some other threads I figured out how I should be formatting it :

{php}
include('http://www.mywebsite.com/_header.php');
{/php}

Still having issues though - I am now getting the error message>

Warning: include() [function.include]: URL file-access is disabled in the server configuration in /clientdata/clients/d/a/ecommercewebsite.com/www/shop/var/templates_c/%%E2^E20^E20954B4%%head_admin.tpl.php on line 7


try read this:

http://www.qijoo.com/fapm/Smarty/Smarty-2.6.14-docs/manual/language.function.include.php.html

Why are you doing "include" in tpl-file?

AgentBristow 04-03-2008 12:35 AM

Re: Is there a way to use an external header.php file for the admin section?
 
Thanks for the reply - not sure that you understand what I am trying to do. The _header.php file is not located on the website with the shopping cart - it is located on an external website. I want to do this so I can use this same external file on all my X-cart installations then only have to update one file on my server if I ever want to make a change...

Yurij 04-03-2008 03:25 AM

Re: Is there a way to use an external header.php file for the admin section?
 
Quote:

Originally Posted by AgentBristow
Thanks for the reply - not sure that you understand what I am trying to do. The _header.php file is not located on the website with the shopping cart - it is located on an external website. I want to do this so I can use this same external file on all my X-cart installations then only have to update one file on my server if I ever want to make a change...



from manual:

Quote:

{include_php} tags are used to include a php script in your template. If $security is enabled, then the php script must be located in the $trusted_dir path. The {include_php} tag must have the attribute file, which contains the path to the included php file, either relative to $trusted_dir, or an absolute path.


AgentBristow 04-03-2008 04:36 AM

Re: Is there a way to use an external header.php file for the admin section?
 
Thanks for your help... I'm sorry but I don't understand any of that. Can someone explain it to me?

balinor 04-03-2008 04:43 AM

Re: Is there a way to use an external header.php file for the admin section?
 
While I understand what you are trying to do, this can/will result in one of those nasty 'The site isn't secure' warnings when in https mode if the images or any other info is being called from an outside source. Just FYI :)

AgentBristow 04-03-2008 04:56 AM

Re: Is there a way to use an external header.php file for the admin section?
 
Ah ok so I guess what your saying is that it's a bad idea? So I assume if I store the file locally and then use:
{php}
include('_header.php');
{/php}

it should work fine and no security warning will be displayed... yes?

balinor 04-03-2008 05:12 AM

Re: Is there a way to use an external header.php file for the admin section?
 
If you are going to store it locally, that kind of defeats the purpose of going outside the Smarty templates at all doesn't it? :)

AgentBristow 04-03-2008 05:21 AM

Re: Is there a way to use an external header.php file for the admin section?
 
lol yeah I guess it does doesn't it! im a dumbass... thanks for your patience and your help :)

geckoday 04-03-2008 06:44 AM

Re: Is there a way to use an external header.php file for the admin section?
 
Quote:

Originally Posted by balinor
While I understand what you are trying to do, this can/will result in one of those nasty 'The site isn't secure' warnings when in https mode if the images or any other info is being called from an outside source. Just FYI :)

An outside source has nothing to do with the secure warnings. A lot of us include google JS code for analytics on our secure pages without a problem. In this case it has even less to do with secure warnings as its a server side include, not a client side include which are the includes that generate security warnings.

The header PHP code would need to generate appropriate href's for http & https to avoid secure warning messages but that's really a moot point. The error message indicates that PHP is configured to not allow includes via URL's - i.e. it only allows local includes. Most hosts do this as a security measure to limit hacker exploits from grabbing malicious code from external servers.

balinor 04-03-2008 06:48 AM

Re: Is there a way to use an external header.php file for the admin section?
 
I disagree. Call an image from http://anotherdomain.com and you WILL get a warning.

exsecror 04-03-2008 07:19 AM

Re: Is there a way to use an external header.php file for the admin section?
 
Quote:

Originally Posted by geckoday
An outside source has nothing to do with the secure warnings. A lot of us include google JS code for analytics on our secure pages without a problem. In this case it has even less to do with secure warnings as its a server side include, not a client side include which are the includes that generate security warnings.

The header PHP code would need to generate appropriate href's for http & https to avoid secure warning messages but that's really a moot point. The error message indicates that PHP is configured to not allow includes via URL's - i.e. it only allows local includes. Most hosts do this as a security measure to limit hacker exploits from grabbing malicious code from external servers.


That's because the Google Analytics code automatically switches to SSL when you're in SSL mode hence why you don't get the warning. I agree with balinor it causes problems and a lot of customers who are not well informed about security will be automatically turned off should they get a warning about "Insecure Content" on the page and a broken lock.

geckoday 04-03-2008 07:21 AM

Re: Is there a way to use an external header.php file for the admin section?
 
Quote:

Originally Posted by balinor
I disagree. Call an image from http://anotherdomain.com and you WILL get a warning.

External <> security errors.
Calling an external file wrong causes security errors.
You should call an external file using http when in not in secure mode and using https when in secure mode - thats easy to do and as I mentioned is done for google analytics.
Code:

<script src="{if $smarty.server.HTTPS eq "on"}https://ssl{else}http://www{/if}.google-analytics.com/urchin.js" type="text/javascript">
But that's NOT what AgentBristow was trying to do. He was trying to include php code server side which is a whole different kettle of fish.

kube 04-03-2008 08:30 AM

Re: Is there a way to use an external header.php file for the admin section?
 
Quote:

Originally Posted by geckoday
He was trying to include php code server side which is a whole different kettle of fish.


True. Until the header code itself contains insecure external urls which may or may not be the case.


All times are GMT -8. The time now is 08:25 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.