adding custom <script> to <head></head> section


Author Message
Steve

Posted: 10/20/2012
Quote message 

Unfortunately you don't have access to the <head> using Artisteer. It is one of many features I have asked for :( :
 
David H

Posted: 10/20/2012
Quote message 

Quote stevenyuko:

Hello every one. I need to know how can I add script stuff to the head section of a page prior to exporting it to drupal. Currently I'm unable to find anything that states how I can do this within artisteer. I don't want to export it to html because then that doesn't help me to export it to a drupal theme. Any help would be great.


You can edit/add scripts between the <head> tags</head> after the template/theme is live on your server. Just ftp into the root of your hosting account and go to the relevant templates folder.

 
-pekr-

Posted: 10/21/2012
Quote message 

David, but that's hardly a solution, no? :-) You will have to edit the template after each export from Artisteer. I also needed such feature, and have a post-processing scripts to do some tweaks, but some user might not be able to write such a script, not beeing programmers. I think, that it would not be a problem to add such field into the Options section ...
 
Raymee

Posted: 10/21/2012
Quote message 

+1 for editing between <head> </head>
 
Les

Posted: 10/22/2012
Quote message 

Being able to modify the <head> tag would really add to Artisteer. Now you must redo it every time you modify the page in an external editor. That is a royal pain and waste of time if you do multiple web sites, Howecer, if you do one active site exporting to HTML and uploading, every freaking time you make a change you must re-apply all google scripts in the head tags. That really needs to be fixed. I consider it a bug.
 
JimmyB7

Posted: 10/22/2012
Quote message 

Quote Les:

Being able to modify the <head> tag would really add to Artisteer. Now you must redo it every time you modify the page in an external editor. That is a royal pain and waste of time if you do multiple web sites, Howecer, if you do one active site exporting to HTML and uploading, every freaking time you make a change you must re-apply all google scripts in the head tags. That really needs to be fixed. I consider it a bug.


I would only add to Les comments, a painful bug!
 
JimmyB7

Posted: 10/22/2012
Quote message 

Could this be a work around, certainly not perfect but easier than remembering all the script that needs to be added outside Artisteer 4?

Add the JavaScript, whatever script, to the “Description” option. Using Home, Options, Default Page Tags, and Description. It will accept the code. Then in an outside editor, Notepad, Dreamweaver, whatever, delete or move: <meta name="description" content="

After I deleted <meta name="description" content=", the code worked that I had added earlier to the Description. I know it’s a jury-rig, but could someone else verify this hopefully temporary option or am I all wet?

Only one thing to remember instead of the numerous <head> </head> changes I have to remember now. :-)
 
Raymee

Posted: 10/23/2012
Quote message 

@Jimmy - interesting idea - I'll try it and let you know how I get on.
7th bloody validation attempt!!!!
 
richard

Posted: 10/23/2012
Quote message 

I don't use Drupal but I have made changes to the fundamental files in Wordpress that allow enhancements to be included for ALL exported themes.

Having a look, drupal base files are in:

C:\Program Files (x86)\Artisteer 4\Library\Data\Templates\Drupal\template

In here you'll find template.php where the <head> section is built.

Before doing anything take a backup of the directory to somewhere safe and don't come crying to me if you don't back up, feck up and have to reinstall... I'll only refund the £0 you paid for this advice...

Anyway, on with the method.

You'll see the <head></head> tags in there.. All you need to do is add what you wish, using valid php calls, JS, HTML or whatever. I'd recommend doing it via an require_once call then placing your code into the called php file. In here you can do PHP, HTML., call JS or css scripts. This means that when you upgrade the only loss will be the require_once call. I would also recommend making it dependent on the file being present. This means that you can exclude the file in an export if you don't want it and the template.php will just skip over. In my WP installs I have a loop that will load any php matching a defined wildcard meaning I can include a set of files or none at all if none exist. http://php.net/manual/en/function.file-exists.php

All the different templates are in C:\Program Files (x86)\Artisteer 4\Library\Data\Templates, though any plugin ones will be in the appdata or similar of your profile...

For WP you'd modify header.php...

There are many easy customisations for Artisteer but the key one, influencing the css produced, is not possible AFAICS as this is produced on the fly at export so no major opportunity to intercept..

HTH
 
richard

Posted: 10/23/2012
Quote message 

ps...you need to set folder and file permissions to enable write ability for your user in Windows or the edits will be made but in a sidelined copy in your profile. This is a windows "feature" pretending to be version control but merely confusing the user.

Also, you need to restart Artisteer after edits as all the files are cached at runtime...
 
richard

Posted: 10/23/2012
Quote message 

Quote :
you need to set folder and file permissions to enable write ability for your user in Windows


pps I don't mean the Windows folder, I mean use Windows to set the perms for the C:\Program Files (x86)\Artisteer 4\Library\Data\Templates folder and those under it..
 
Les

Posted: 10/23/2012
Quote message 

Only problem with this, unless I am wrong, ALL subsequent sites created will have the same Google tracking code. This cannot work because there is a different code for tracking for each web site. I have build 10 sites so far with Artisteer and all have different tracking codes.

Quote richard:

I don't use Drupal but I have made changes to the fundamental files in Wordpress that allow enhancements to be included for ALL exported themes.

Having a look, drupal base files are in:

C:\Program Files (x86)\Artisteer 4\Library\Data\Templates\Drupal\template

In here you'll find template.php where the <head> section is built.

Before doing anything take a backup of the directory to somewhere safe and don't come crying to me if you don't back up, feck up and have to reinstall... I'll only refund the £0 you paid for this advice...

Anyway, on with the method.

You'll see the <head></head> tags in there.. All you need to do is add what you wish, using valid php calls, JS, HTML or whatever. I'd recommend doing it via an require_once call then placing your code into the called php file. In here you can do PHP, HTML., call JS or css scripts. This means that when you upgrade the only loss will be the require_once call. I would also recommend making it dependent on the file being present. This means that you can exclude the file in an export if you don't want it and the template.php will just skip over. In my WP installs I have a loop that will load any php matching a defined wildcard meaning I can include a set of files or none at all if none exist. http://php.net/manual/en/function.file-exists.php

All the different templates are in C:\Program Files (x86)\Artisteer 4\Library\Data\Templates, though any plugin ones will be in the appdata or similar of your profile...

For WP you'd modify header.php...

There are many easy customisations for Artisteer but the key one, influencing the css produced, is not possible AFAICS as this is produced on the fly at export so no major opportunity to intercept..

HTH


 
richard

Posted: 10/24/2012
Quote message 

Quote Les:

Only problem with this, unless I am wrong, ALL subsequent sites created will have the same Google tracking code. This cannot work because there is a different code for tracking for each web site. I have build 10 sites so far with Artisteer and all have different tracking codes.




Yes you are wrong Les. There is nothing in my post to suggest that the same google id need be used.

You could make the read in file call a function that reads the id from a file (if it is present) e.g. google_analytics.tc which holds nothing but the google tracking code. This means that all you need to do is create or edit the file with the code in. In WP the function call could be placed in the header using an action:

e.g.
add_action( 'wp_head', 'load_goggleanal' );

meaning that when the header is created it includes a call to the function load_goggleanal to insert the required HTML for GA. The function would be placed in your custom funcs file or, if you wish, in functions.php (remembering that you'll need to reinstate when you next upgrade Artisteer...

There are many ways to cut this, none of which ties you to a fixed value. In WP you could also edit the default options.php that Artisteer includes in the them to create theme options for GA that are then settable through the WP admin Theme Options screen (I'm sure similar is possible in drupal etc). Then, with the supporting code in the framework you'd call get_option() to pull the value from the db, build your HTML and insert into the header using the action mentioned above.

I use the action method to implement LESS css in my themes (currently other than Artisteer) which gives me a global css file with the ability to group browser specific css3 calls into a single mixin function. Once it's in the framework all I need to do is provide the custom css on a theme/implementation basis..

The only limitations are those you chose to place on yourself...

 
Raymee

Posted: 10/27/2012
Quote message 

@Jimmy that worked for me many thanks for the tip.
 
JimmyB7

Posted: 10/28/2012
Quote message 

Quote Raymee:

@Jimmy that worked for me many thanks for the tip.


:-)
 
Tina O'Connell

Posted: 10/24/2013
Quote message 

This feature clearly needs to be added to the basic software.. When will this be done?
 
Dave B

Posted: 10/24/2013
Quote message 

Quote Tina O'Connell:

This feature clearly needs to be added to the basic software.. When will this be done?


What version are you using? It has been added.

 
Tanya
Artisteer Team

Posted: 10/24/2013
Quote message 

This feature is available in Artisteer 4.2 RC.
http://www.artisteer.com/?p=news

Please open Theme Options / Additional HTML.
 
kks

Posted: 8/8/2016
Quote message 

:(
Hello Everyone...
Can Anyone please lemme know where should i keep PHP CODE. I have search alot but i'm not getting it.i need solution asap.

Thank you.
 

Reply


NAME *
EMAIL
SMILIES :-) :( :-D 8-) :*) :-/ :-{} :-X :-O :-@ O:) :-P :-< :-( :-| ;-) 
CODES [Quote] [B] [I] [U] [Code] [IMG] 
BODY *  
VALIDATION *