Welcome, Guest. Please login or register.
Did you miss your activation email?
May 23, 2012, 09:38:26 AM

Login with username, password and session length
Search:     Advanced search
Interested in joining the WebsiteBaker team?
For more Information read here or on our new website.
155400 Posts in 21698 Topics by 7729 Members
Latest Member: adnan
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Put 'code sections' within <head></head> tags  (Read 696 times)
sharmpro

Offline Offline

Posts: 64



WWW
« on: June 25, 2008, 11:44:40 PM »

Hi,

in order to ensure some more valid HTML to my site I needed to move some 'code' section from the body of the page to the head.

Here is the tiny snippet 'code_top' that check if your code section has two special marker and then if enabled put the show your code in the point you decided into the template file.

Check instruction into info.php file.

Enjoy

Stefano


New release posted below
« Last Edit: June 30, 2008, 02:59:38 PM by sharmpro » Logged

doc
Guest
« Reply #1 on: June 26, 2008, 06:00:41 AM »

Hello Stefano,

in order to put Javascript or CSS definitions from a module into the head section of your template, you simply need to call the register_frontend_m odfile function in your template as described on the help site. Then simply place a frontend.css or frontend.js file in the module folder and you are done.

Is this what you are after?

Regards Christian
Logged
sharmpro

Offline Offline

Posts: 64



WWW
« Reply #2 on: June 26, 2008, 02:07:56 PM »

Hi Christian,

I'm using a lot of page generated by code sections, and sometime i need to dynamically generate Javascript and CSS, plus these scriptssare not generic use for all pages....
So i prefer to control the structure via code sections and there define scripts ans styles, this way each page can generate his peace of code needed and inserted into the document section as for better HTML validation.

Regards,

Stefano


Logged

doc
Guest
« Reply #3 on: June 26, 2008, 03:57:16 PM »

Stefano thanks for clarification.

Regards Christian
Logged
sharmpro

Offline Offline

Posts: 64



WWW
« Reply #4 on: June 30, 2008, 02:55:13 PM »

Hi,
I refined the first release with:

1.You can specify block of code to put into the <head> of the document in more than a section, the limit is only a block per section.

2.The 'marked code' can co-exists with code that will be rendered into the document body as normal.

3. Updated info.php on the snippet.


New release posted below

Regards,

Stefano
« Last Edit: June 30, 2008, 09:27:27 PM by sharmpro » Logged

sharmpro

Offline Offline

Posts: 64



WWW
« Reply #5 on: June 30, 2008, 09:26:18 PM »

Hi,
this release fix a bug...
Was not working if the /*into<head></head> mark was at the beginning of the cose section (pos. 0)


Enjoy.


Stefano
Logged

Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!