Jump to content

div background picture - move to tpl?


PascalVG

Recommended Posts

Hi,

 

I am playing with php and writing some prestashop module, first of all to see the process of building one. (it's a fully adjustable "news ticker", for those interested)"

 

Having still relatively little experience in css/php combi, I had the following question.

 

Every time you look up about background images in a div tag, you see some php/css code mix like

 

<div style="background-image: url(../images/test-background.gif); height: 200px...

 

I can imagine this sort of 'breaks the rule' of separating function and style, so I was wondering how to take out this style part from the php file and put it in a css file (tpl??) and maybe put this in the theme's folder or so. (A reference to my background file is in the ps_configuration file.)

 

I expect/presume I have to play with some <div class="my-div-class-for-a-background-pic" and then reference to this class from the tpl file or so??

 

Any suggestions how to set this up??

 

 

(N.B. If I am totally wrong and I should just add it to the div tag, that's also ok, just let me know :-) )

 

 

Thanks!

Pascal

Link to comment
Share on other sites

Hi Vekia,

Thanks for the reply. I'll have a look at it.

This css file, I just put in my main modules/mynewmodule folder, next to my <mynewmodyle>.php like mynewmodule.css, or should I put it in the themes/mytheme/modules/mynewmodule folder?

 

Thanks

(BTW, I do see many <div style"..."> in the basic prestashop files. Is it generally accepted to do so?)

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...