Gamestech Posted April 25, 2014 Share Posted April 25, 2014 Hi guys, Throughout our theme we have a header image. On certain pages we'd like to change this image based on a database field or even a specified value. So essentially what I'm looking to do is declare some sort of global javascript function in one of the js files so it's available on every page if required. Then in each page template, I plan to call this global js to override the header image. What I'm struggling with is where each part goes. I'm fine updating the classes/tables required to add the field, it's more where to add the JS to perform the override and how to call it. Any tips appreciated. Link to comment Share on other sites More sharing options...
vekia Posted April 27, 2014 Share Posted April 27, 2014 it will be much easier if you will use php code, it will be much easier. in frontcontroller you can create function named: public static function getMyHeader($page){ } this function depending on $paga variable will return value from your database. then in header.tpl file you can use this: {FrontController::getMyHeader("something")} depending on return value - you will be able to display image you want. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now