[support] Write a text into a page like a node

Ivan Sergio Borgonovo mail at webthatworks.it
Wed Jan 9 10:06:15 UTC 2008


On Wed, 09 Jan 2008 10:03:38 +0100
Davide Michel 'ZioBudda' Morelli <michel at ziobudda.net> wrote:

> Ivan Sergio Borgonovo ha scritto:
> > I bet because paths in bootstrap.inc are relative.
> > Wouldn't it be better to write a custom template for that page?
   
> Nope, I need to use it for other pages, too (if it is possible).

If you write a module you can use -page.tpl.php for as many pages as
you wish.

> My scenario is this: I have a script that I need to incorporate
> into my template. The output of this script is generated from some
> data insert into a form that the script display. The script display
> this form into output page, too. When a news version of this script
> is ready, i need to delete the old one and insert the last script.
> So a drupal module is impossible to mantein.

If the script was not written in a way it can be easily embedded
well... it won't be easy to embed it ;)

If they did something like

file1.php:
<?php
...
require_once('bla.php');
...


bla.php:
<?php
$globalvariable="blabla";

function a() {
}
function b() {
}
?>
<strong>some html outside functions</strong>


It is hard you'll ever be able to include bla.php to reuse functions
a() and b() in a clean way.

Once you've to deal with such code you'll have to do dirty things.

Of course you can wrap everything inside a function in a module being
careful to take care of the scopes and paths.

mymodule.php
function myfunc() {
require_once('bla.php');
};


-- 
Ivan Sergio Borgonovo
http://www.webthatworks.it



More information about the support mailing list