By artcoder on
In my page.tpl.php, I'm including php code from another php file as in ...
<?php include "http://example.com/themes/mytheme/right-sidebar.php"; ?>
It works. But I know enough to know that it is not the most proper way to do it because it is hard-coding the domain name as well as the template name.
How to do it properly where system can resolve the domain name and the template name correctly?
Comments
if u dont put full link, by
if u dont put full link, by default, the file in the same folder will be used.
Okay, I see. But now why is
Okay, I see. But now why is it that I am not able to use
in my included file. But I can use it find in page.tpl.php.
Is there a way for me to access all the same variables in the included file that I have access to in the main file page.tpl.php?
I might be wrong but if I
I might be wrong but if I remember right you can global in $node to your included file. You would have to do the same with any other page.tpl.php variables that you want to use within the scope of your included file.