Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Need to dynamically insert unique code into <head>

Posted on 2013-01-04
4
Medium Priority
?
449 Views
Last Modified: 2013-01-05
I have some Google Publisher ads that I need to setup on a site which require specific code to be inserted into the <head> area of each page, but they need to be unique. In other words, the home page will have certain code in the <head> to correspond with the ads on that page, and the Contact Us page will have different ads and different code in <head>.

I can't seem to find any way to do this dynamically in Joomla 2.5.7. I'm currently using Flexi Custom Code modules for the ad code and that works fine but there is no way to dynamically insert the correct code into the <head> based on the page the visitor is on. I've searched the forums and for extensions - no dice. AdSense extensions won't work because they only inject the ad code - not the <head> code.
0
Comment
Question by:sc456a
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 26

Accepted Solution

by:
lenamtl earned 2000 total points
ID: 38745886
Hi,

You can achieve this using a module, you will need to duplicate the module for each page and select the appropriate page in module settings.

Here is a list for custom code modules:
http://extensions.joomla.org/extensions/core-enhancements/coding-a-scripts-integration/custom-code-in-modules

EasyHeader could probably do the job:
http://extensions.joomla.org/extensions/core-enhancements/coding-a-scripts-integration/custom-code-in-modules/11936
0
 
LVL 1

Author Comment

by:sc456a
ID: 38745942
I've tried several. Custom HTML Advanced doesn't work because it just injects the code as a CSS style reference. EasyHeader doesn't allow you to inject code based on an article or module; just one interface that injects the code site-wide.
0
 
LVL 16

Expert Comment

by:HagayMandel
ID: 38746309
I'm not a Joomla man but it seems that the direction to accomplish this should be the template page:
In other words, a script that rebuilds the head section according to the current page id/title, prior to the actual page rendering.
0
 
LVL 1

Author Comment

by:sc456a
ID: 38747754
I had to try a bunch to find one that would do it: Robert Went's Mod Custom Plus will do the trick. Here is the link:

http://extensions.joomla.org/extensions/core-enhancements/coding-a-scripts-integration/custom-code-in-modules/17842
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question