Maybe this is not the right question - so i will likely end up posting this a couple times here.
=================
What do i do to have a module put a piece HTML code ONCE into my page ?
I was trying to use hook_nodeapi which sort of works.. except that my page has 3 nodes on it.. therefore it was doing this 3 times... which in FF it didn't seem to be an issue (not sure why not.. likely it was doing it but other 2 copies were buried).. but they show up in IE.
the html i am adding doesn't really matter where it goes - since it is a DIV with absolute postioning... but would be nice if i could get it to go in the html body.
I read that i could use hook_menu and that sort of works in FF but, again, not very well in IE... and makes ugly HTML since it throws my html before the html tag.
but perhaps i am not using hook_menu correctly???
Comments
Never tried this but what
Never tried this but what about hook_footer?
___________________________________
http://aqon.com
i took a look at hook_footer
i took a look at hook_footer and it sounds like what i am looking for; but seems to do the same thing as hook_menu
any chance you have an example?
this is what i did:
sorry.. i would have posted real html that goes in here.. but this forum sucks... and wont let me...
basically it is div and img tags
Peter Lindstrom
LiquidCMS - Content Solution Experts
return not echo
Beware with echo & print in hook_ implementations! According to the API docs for hook_footer you need to return the HTML that has to be printed above the closing body tag (the contents will end up in the phptemplate variable
$closurefor example).As to your hook_nodeapi experiments: it's certainly not the way to do it, go with hook_footer, but PHP has some sort of persistent local variables that you may well know from other languages. These are called static variables. You can use these for example to count how often a function is called.
The last line of your code should read:
Good luck!
Heine
PS The XSS filter is very stringent, that's why some tags lead to the 'suspicious content' warning.
--
Tips for posting to the forums.
When your problem is solved, please post a follow-up to the thread you started.
ahhh.. it's a return thing
ahhh.. i seeeee... cool.. that makes more sense...
i'll give it shot.
Peter Lindstrom
LiquidCMS - Content Solution Experts
yeaaaa baaaby!!
very cool.... that was it
i guess in the API it does state:
doohhhh!!.
check it out if ya like... http://www.allanalog.com/d0214/
my little module does the AJAX "showcase" that scrolls through nodes in a specific category and dumps them into my header...
the hook_footer bit adds the little control panel thing just above it.
cheers,
Peter Lindstrom
LiquidCMS - Content Solution Experts
Template files or SSI
Write the HTML code into your phptemplate files. In the theme directories that I am familiar with there are files called like page.php.tmp and node.php.tmp.etc or some sort that control the layout of your site as code is pulled from your database. You can hardcode the HTML in there or make up a server side include that directs to a file with the HTML in it. Be better to do an SSI because then you don't have to mess around with your template files each time you want to change that. I can give you more info if you email me, if you need it.
Sean
Cambridge Community Television
http://www.cctvcambridge.org
nope.. that can't do it...
Hi Sean,
i suspect i was not clear enough in what i am trying to do.
I am designing a module. the module needs to add some floating (i.e. abs position) img's to my page...
This is not static.. they are added to each page if the module is enabled.. and more specifically they are distributed with the module... therefore can't be added to .tpl theme files
but thanks for the reply..
Peter Lindstrom
LiquidCMS - Content Solution Experts