templates, called from other -different- site

About the template and stylesheet - and changing the menu

templates, called from other -different- site

Postby stargazer96 » Sun Jul 08, 2012 10:43 am

Hi All,
hello CMSimple fans!
I have a main website and also few small websites too, and everytime when I need to change something on a template, I need to uploaded on all other sites too.
Would it be possible that templates should be uploaded only on one website (the main website) and to be called/loaded from this one site to another (small one)?
(in this case would be enough to change / modify only on the main site the appropriate template, and the results will appear also on other site(s) too). Could anyone help me with this issue? With this issue resolved, we could extremely ease our work. All constructive ideas would be appreciated.
Thank you in advance.
stargazer96
 
Posts: 7
Joined: Sat Jul 07, 2012 6:16 pm

Re: templates, called from other -different- site

Postby cmb » Sun Jul 08, 2012 11:58 am

Hi stargazer96,

one possibility might be to use PHP's URL-aware fopen wrappers. This requires the PHP ini settings allow_url_fopen and allow_url_include to be on, which might not be permitted to change on some hosts for security reasons.

Then you can change cmsimple/cms.php line 149 from:
Code: Select all
$pth['folder']['templates'] = $pth['folder']['base'] . 'templates/'; 

to
Code: Select all
$pth['folder']['templates'] = 'http://www.example.com/templates/'; 

To suppress the warnings, that the template and stylesheet can't be found, change cmsimple/cms.php line 360 to:
Code: Select all
foreach (array('content', 'pagedata', 'config', 'language', 'langconfig', /*'stylesheet', 'template',*/ 'log') as $i) 


This should basically work, but is probably much slower than using the template stored on the same domain. It's okay for testing, but for production use I would recommend to synchronize the other domains with the main domain via FTP.

Christoph
Christoph M. Becker---Plugins for CMSimple_XH
cmb
 
Posts: 5484
Joined: Tue Jun 21, 2011 11:04 am
Location: Germany

Re: templates, called from other -different- site

Postby stargazer96 » Sun Jul 08, 2012 5:15 pm

dear Christoph,
thank you very much for your help and for your answer(s). Before requested the help of forum members, I tried several thinks (unfortunatelly I am not so skilled in php :( ). I tried the method you suggested, unfortunatelly, it is still not working, maybe only because -as you mentioned- I do not have setted the PHP ini settings allow_url_fopen and allow_url_include to be on...
anyhow, I would like to thank you very much for your kind help, I will try further to make the settings you recommended, and I will let you know -of course- if I succed.
Thank you very much again for your kind help.
Sandor / Stargazer96
p.s.
I forgot to mention that I am using CMSimple 3.3
stargazer96
 
Posts: 7
Joined: Sat Jul 07, 2012 6:16 pm

Re: templates, called from other -different- site

Postby cmb » Sun Jul 08, 2012 6:35 pm

Hi Sandor,

in CMSimple 3.3 the code that has to be changed is located on different lines (and probably looks not exactly the same). But it seems you've managed to find the places. :)

You can check the settings of allow_url_fopen and allow_url_include, if you put the following code to a file test.php:
Code: Select all
<?php

echo phpinfo
();

?>

Then you have to call the file (e.g. http://www.example.com/test.php) and search for both settings (they should be "On"). Afterwards delete this file! (nobody else should see this information)

About allow_url_include: this setting is available only since PHP 5.2. So if you're using an older version, you can ignore it. Otherwise, if it's set to "On", you can't change it yourself (unless you have write access to php.ini or httpd.conf; I'm assuming the sites are hosted on an Apache server) -- this has be done by your provider.

You can change the setting of allow_url_fopen by an additional line in .htacess:
Code: Select all
php_flag allow_url_fopen on

(see http://de.php.net/manual/en/configuration.php)

Christoph
Christoph M. Becker---Plugins for CMSimple_XH
cmb
 
Posts: 5484
Joined: Tue Jun 21, 2011 11:04 am
Location: Germany

Re: templates, called from other -different- site

Postby stargazer96 » Tue Jul 10, 2012 8:24 am

Hi Cristoph,

thank you for your answer (it is good to feel that when you have a problem to resolve, you are not alone and there are nice people who can help :) !!
I tried your recommendation and checked the allow_url_fopen and allow_url_include, first is On, second is set to Off.
(after checked, I deleted the test-php file - thank you for the advice).
Anyhow -as you guessed and mentioned- I do not have the rigts to modify php-ini, so I think I will follow your advice and recommendation gave on
viewtopic.php?f=5&t=4831
regarding ftp clients.
Thank You -again!! :) for kind help and support and I wish you a nice day!

Sincerely,
Sandor
stargazer96
 
Posts: 7
Joined: Sat Jul 07, 2012 6:16 pm

Re: templates, called from other -different- site

Postby greatingz » Thu Mar 21, 2013 12:32 pm

hello!

i have a trouble with PHP scripting in templates.

for example, in overall_footer.php i've insert example script:

<!-- PHP -->
echo "test";
<!-- ENDPHP -->

but it doesn't work!!!

what i should to do ?
greatingz
 

Re: templates, called from other -different- site

Postby cmb » Thu Mar 21, 2013 12:55 pm

Use proper PHP code:
Code: Select all
<?php echo 'test';?>
Christoph M. Becker---Plugins for CMSimple_XH
cmb
 
Posts: 5484
Joined: Tue Jun 21, 2011 11:04 am
Location: Germany


Return to Changing layout

Who is online

Users browsing this forum: No registered users and 1 guest