Loading a static template and stylesheet into EE.
I’ve seen a few people ask, in the EE forums, for a series/tutorial on building a complete website in ExpressionEngine. I figured - why not? It’s not like I have anything else to do (insert rolling eyes smiley here..)
So - here’s the plan. Take a free CSS site template and work through the process of bringing it into ExpressionEngine, from start to finish. I’m planning on a typical, genericized business site architecture of Home, About, Products, Services, a Weblog, and a Contact Page.
In this first chapter, we download the template files and bring the HTML and CSS into ExpressionEngine, getting EE to serve up the static template.
Note - if you’re going to follow along with this series please do not use any of the default templates that install with ExpressionEngine as your basis. Nothing against them - they just have some variables and and other more advanced features that make it hard to use them as a simple starting point. I also think the practice of using a static, non-EE template is closer to how many (most?) EE sites get developed. Also - these tutorials assume a pretty good working knowledge of XHTML/CSS. If you aren’t comfortable editing CSS selectors, using div tags, or don’t know how to use the W3C CSS and (X)HTML validators then this tutorial series may not be for you. A good share of the issues I’ve worked through with people using this series are straight HTML or CSS related - missing div tags, extra spaces in CSS files, etc - so the more comfortable and experienced you are at solving those problems the easier it will be to make the jump to ExpressionEngine.
OK - so let’s get started!
I’ll assume you have downloaded and unzipped the template archive onto your local hard drive. Got it? Good.
1. Upload the Images
Now you’ll need to figure out where on the server you want to put the images. Using an FTP client, make a directory if need be. I usually create an “interface” directory under the default EE “images” directory. For the purposes of this tutorial I created a new subdirectory at images/interface/building_series. I uploaded all the images from the template archive there.
2. Edit Image Paths in the CSS File
OK - now to the CSS file. I’m picky - I don’t like my CSS statements all on one line as it’s tough to scan and modify the file. I went through the CSS for this template and put in all the carriage returns and tabs using TopStylePro. I know there are more automated ways to do this, but I like doing it manually as it helps me get familiar with the CSS and look for any trouble spots like content with fixed heights.
Regardless of how you like your CSS formatted, you will need to edit the paths to any images. My standard approach is to give them a complete path, but using the {site _ url} variable for the root so that it changes when my site goes from it’s temporary URL to the final live URL (Note—take the spaces out for the actual variable. I added them so EE wouldn’t parse the variable here in this entry with the path to boyink.com). {site _ url}, unless you’ve specified otherwise in your EE path.php file, takes it’s value from the homepage setting under CP Home > Admin > System Preferences > General Configuration.
I use the Find and Replace function in TopStylePro, and in this case changed image paths from:
images/topbg.jpg
to
{site _ url}images/interface/building_series/topbg.jpg
3. Create a CSS Template In EE
Once you have that done, go into the EE control panel and choose a location for your stylesheet. Typically I have these in their own template groups, but for this tutorial I’m going to keep all the templates in one group called “building_series”. Create a new template, give it a name (I’ve called mine “stylesheet") and make sure to set the template type to “CSS Stylesheet”. Click Submit.
4. Copy/Paste the CSS Code In
Click the new template name to edit it, and copy/paste in the CSS code. Save the template. Oh - this is a good time to mention that you should turn on template revision history. Click “Global Template Preferences”, check “Save Template Revisions” to “Yes”, and choose the number to keep. I usually keep 10. Enter your settings and click Update.
5. Edit Image Paths in HTML
OK - now for the HTML.
You’ll also need to edit the image paths in the html, so they go from this:
images/img2.gif
to this:
{site _ url}images/interface/building_series/img2.gif
6. Create a Web Page Template in EE
Once you have that done, go into the EE control panel and create a new template for the HTML. I’ve used the index one in my new template group. Give it a name and accept the default of “Web Page” under Template Type. Click Submit.
7. Copy/Paste the HTML Into EE
Now click the newly-created template title to edit it, and copy/paste in the HTML File. Click Update.
8. Edit the CSS Link in the HTML File
There is one more thing to do in order to have ExpressionEngine serving up our static HTML and CSS - and that’s to edit the link to the CSS file in the HTML.
In the HTML, the default link is (note - I’ve removed the opening and closing wickets in order to get the text to appear here):
link rel="stylesheet" href="stylesheet.css" type="text/css"
This needs to change to the EE style of link:
link rel=’stylesheet’ type=’text/css’ media=’screen’ href=’{style sheet=building_series/stylesheet}’ (Note: Remove the space from “style sheet”)
You’ll need to make sure the path after the “href stylesheet” reflects the template group and template name of your CSS file.
Here is the text version of my updated index template which contains a properly formatted link: chapter_1_index.txt
Once you’ve recoded the link, click Update to save the template.
Note: I’ve had some feedback that the single quotes mentioned here weren’t working and had to be replaced by double quotes, IE:
link rel="stylesheet" type="text/css" media="screen" href="{style sheet=building_series/stylesheet}”
So if you have issues with content not getting styled that might be one thing to try
9. View the Rendered Template
Now Click “View Rendered Template”. You should—barring any typos in your path statements - get the static HTML and CSS as served up by EE. Here’s mine: http://www.boyink.com/splaat/building_series/chapter_1_index/
That’s it for Chapter One. In the next installment we’ll start chunking up the full HTML file into embedded templates, so that things like main navigation and footer text are stored in one place ExpressionEngine.
I’m not sure how often I’ll be able to sneak another chapter in—but I figure handled in small chunks probably once a week or so.
On to Chapter 2.
Visit Train-ee.com for the latest in ExpressionEngine training designed with one goal in mind - to get you up to speed on ExpressionEngine® as quickly as possible.
The latest Train-ee Products:
The latest from the Train-ee blog:
August 02, 2007
At last! Many thanks for this. I have built two sites in EE now but when I come to do a third one I need to cut out the 50% of the time I took in the first two to understand how to build them! I look forward to your next instalments.
August 02, 2007
Thank you so much for doing this. I think it is excellent that you have taken this on. It is something out community has needed for a long time.
August 02, 2007
Good start to a EE site building tutorial. If only I had this a year ago when I started using EE.
August 02, 2007
Mike: I’m assuming that your use of {site _ url} with spacing is to keep EE from parsing that in your article. That might be helpful to point out, so that people don’t accidentally use incorrect syntax based on the tutorial.
August 02, 2007
You mean something like “(Note -take the spaces out for the actual variable. I added them so EE wouldn’t parse the variable here in this entry with the path to boyink.com)”...
August 02, 2007
Oh, that. Yeah. Can you tell I skimmed the article? haha.
August 04, 2007
For the adventurous one, try another template and keep along with the future tutorials!
Makes it a bit more challenging. lol.
August 09, 2007
Haha, I was thinking the same thing (writing a tut) last week after reading some posts on the forum by frustrated beginners… Good job Michael as usual!
August 22, 2007
Cool! I like CodeIgniter, but I didn’t get around to understand EE yet. Maybe this tutorial will help!
October 03, 2007
Dang… nearly two months on, and I’m just now getting busy.
I suppose EE - http://www.expressionEngine.com will break out a new version soon, something’s up over there, not sure what though, everything’s hush-hush.
Maybe the B-meister’s in the loop?
Should I continue with the current version or wait a few days to start cracking, I’ve waited this long.
October 03, 2007
I know nothing more about the status of EE2 than you do…
And if I did...I know which side my bread is buttered on...
October 03, 2007
Oh no don’t say that it’s all gone quite at Ellis Labs because they are about to bring out a new version - I just spent 3 months relearning EE!!
October 09, 2007
Is {site_url} something you created in your path.php file? I don’t see any mention of it in the docs on the EE site.
And how far away is EE 2? We just got 1.6 but haven’t gotten further than trying to read all the documentation we can find (including your tutorials)
October 09, 2007
{site_url} is an existing path.php variable, that unless you change it contains the path to the root of your site.
Re: EE2—As I’ve stated already in these comments I don’t know anything more about the status of EE2 than you do.
October 16, 2007
I’m a newbie and trying to follow this tutorial on a mac, and can’t seem to get things to render properly.
The index page loads, and text renders. Graphics referenced in the index file also render, but background graphics and other things contained in the .css file do not appear to get pulled in. I’ve checked and re-checked my references, and seem to be missing something.
Any ideas?
October 17, 2007
Hi Larry -
Is the css getting applied to the html at all, or is the html totally unstyled.
If it’s totally unstyled, it’s probably the link from the html to the css.
If it’s partially styled, make sure your css is validating.
October 17, 2007
Michael,
The .css is not being applied to the .html. The .html appears to take on the default browser styling.
Can you post a .txt file of the template? so I can compare syntax.
BTW - Appreciate your site and passion for connecting folks to EE. If I can just get the hang of things, I intend to move forward with maintaining our worship ministry site in EE. The learning curve has seemed somewhat difficult, but your tutorial provides a good on-ramp.
Larry
October 18, 2007
Hey Larry - the css link is posted in the article, though I have had feedback that the single quotes needed to be double:
link rel="stylesheet" type="text/css" media="screen" href="{style sheet=building_series/stylesheet}”
again remove the space in the style sheet word in the brackets - I had to add that or EE would try to parse the link here on the page.
October 19, 2007
I know I’m doing something wrong here, but I can’t figure it out. It looks like all the links are correct, but still the stylesheet isn’t loading.
October 19, 2007
I’ll bet you don’t have the template set to CSS in EE. If you look at the icon next to it in the EE control panel, is it a blue globe? If so - it’s still set to HTML.
October 19, 2007
Nope, it’s not the blue globe thing. It has the CSS icon.
October 19, 2007
Hmm…
Have you tried changing the single quotes in the stylesheet link to double quotes?
October 20, 2007
|Yes, I did. I guess I need to start all over
October 20, 2007
No - don ‘t do that. Can you post a link here?
October 20, 2007
http://www.stipvoorstip.nl/blog/index.php/building_series/index/
October 20, 2007
OK - if you do a view/source on your rendered page there are some junk characters at the end of your stylesheet link.
October 20, 2007
I just noticed them. Strangely enough I can’t find them in the templates. Goes to hunt them down.
October 20, 2007
hey Mike, I’ve been following this tutorial as well and seem to be experiencing the exact same problem that Edwin is having. I’ve also changed the single quotes to double quotes but it hasn’t done anything.
http://www.pawsonpalmer.com/index.php?/building_series/index/
Do you think perhaps something has changed from the time you wrote this tutorial to the time we are trying to follow it? Seems odd that the images would show up correctly but the CSS file does not.
October 20, 2007
Hey Carlos - your css link is also rendering incorrectly but in a different way. You have a brace getting through - your link is:
<link rel="style sheet” type="text/css" media="all" href="http://www.pawsonpalmer.com/index.php?css={building_series/stylesheet" />
Mine is:
<link rel=’style sheet’ type=’text/css’ media=’screen’ href=’http://www.boyink.com/splaat?css=building_series/stylesheet’ />
(again note I added the space in the first “stylesheet” to prevent the browser from trying to parse the link here.
October 20, 2007
Also note that EE is doing some replacing on the quotes -so don’t try to copy/paste the above.
October 20, 2007
Yea, I saw that. No clue why that’s happening though. I changed the quotes from double to singles but it didn’t do anything.
October 20, 2007
Post your link from the EE template - before it gets rendered.
October 21, 2007
This is the one i’m using for your tutorial:
<link rel=’stylesheet’ type=’text/css’ media=’all’ href=’{stylesheet={building_series}/stylesheet’ />
And this is the one that came with the default site:
<link rel=’stylesheet’ type=’text/css’ media=’all’ href=’{stylesheet={my_template_group}/site_css}’ />
What do you think?
October 21, 2007
You are missing a closing bracket:
<link rel=’stylesheet’ type=’text/css’ media=’all’ href=’{stylesheet={building_series}/stylesheet}’ />
October 21, 2007
That’s not the link from the tutorial - as I don’t use braces around the building_series template group name:
link rel=’stylesheet’ type=’text/css’ media=’screen’ href=’{style sheet=building_series/stylesheet}’
The defaut site link is different because it’s using a variable there instead of a direct reference.
October 21, 2007
Done. I type the link rel.... line in myself, and it worked now.
October 22, 2007
It worked! Thanks Mike. Btw, you may want to take out the part where you say to copy the links from the default template as other people may end up doing what Edwin and I did.
October 23, 2007
Good point Carlos - I removed that and supplied the text version of my template in hopes of getting folks through this tricky spot.
November 12, 2007
Hi All finally started on this excellent series, after some minor troubles on a Windows server it’s running for now.
Copy any error messages you may get and paste them in at the forums over at expressionEngine.com and you will usually find an answer or a narrow list of things to try.
My Chapter 1 page badge of courage is linked to my user name.
November 21, 2007
Hi,
I’ve followed the first part of your tutorial, when I take a look at the generated code I see: “index.php?css=building_series/stylesheet.v.1195673318”. What’s the .v.1195673318? How can I disable this? I cannot see this in your example.
Thanks!
November 21, 2007
Boy - got me there. What does the link look like as it appears in your template?
November 21, 2007
It’s placing a query string in the called stylesheet somehow?
Are you sure that’s not hard-coded in the code, or did you turn query strings on? I turned query strings on because I thought maybe I needed to on a windows server (was having troubles), but I don’t see those on the style sheet call.
Would using a variable like they show here help, or is it a possible solution?
http://expressionengine.com/docs/templates/globals/stylesheet.html
November 22, 2007
I’ve following link in my template:
<link rel="stylesheet" type="text/css" media="screen" href="{stylesheet=building_series/stylesheet}" />
I’ve tried to disable the “Generate HTTP Page Headers?” in the System Preferences, and now the the string is no longer displayed.
Can someone please explain the use of this? I’m just starting to learn ExpressionEngine…
Thanks!
November 27, 2007
Hello - another newbie here determined to learn Expression Engine and so glad to have found this tutorial. However, I am stuck already! I cannot get my stylesheet to link up. I have been through all these posts and the EE forums, wikis and knowledge base. My stylesheet template type is set to CSS stylesheet. I’ve changed single quotes to double quotes. I tried a different doc type as recommended by one user, that solved one person’s problem. There are no junk characters when I view source. I have stared at the syntax and re-typed it many times over.
What am I missing?
November 27, 2007
Do you have an error message, or link?
Question for Mike?
Is it possible to just use a regular stylesheet link like:
<link rel=’stylesheet’ type=’text/css’ media=’screen’ href=’http://crssp.com/EE/index.php?css=building_series/stylesheet’ />
That’s what shows up in the page head after EE renders it anyways? I’m sure there are advantages to using the EE type of stylesheet link, but is a plain old xhtml version work?
November 27, 2007
No error message, just unstyled content. Here is the link:
http://www.annawilder.com/index.php?/building_series/index/
November 27, 2007
Not sure, but try dropping the .css from the end of the call.
Yours says stylesheet.css, loading theurl in my browser address bar and it doesn’t show up. Pasting my own in that I’ve shown above and it does indeed show up.
My version has query strings turned on do to a windows hosting glitch, whether that’s significant I don’t know.
November 27, 2007
Yes, the .css was one of the things I tried. I just took it off and have the same problem, although the content is slightly less stylized now.
And yes, I had already turned on “Force URL query strings.” Before I had that turned on I was getting the “no input file selected” message upon rendering the page.
November 27, 2007
I still have the default “site” templates in my directory (from the core installation.) Could that be a conflict?
November 27, 2007
Guys -
I can’t stress strongly enough that the W3C validator should be your first stop for issues like this.
Evelyn—you are missing a closing “/” in your stylesheet link. Since the doctype is set to XHTML strict you need to “self-close” your css tag.
The validator is picking up the issue and generating 6 errors that will likely all go away with the addition of the slash.
November 27, 2007
Thanks for the help Mike and Ty. It actually wasn’t the closing “/”, as I was using a transitional doctype at that time. And even when I added them it didn’t fix my problem.
But with the help of a very experienced programmer who was also stumped for a while, we pasted in a new html header from another file and voila, it worked. I am now moving right along…
I will be sure to always validate my html and css from now on!
December 10, 2007
Thanks for the great tutorial mike! You wouldn’t happen to know how to refer to javascript would you?
December 10, 2007
Thanks for the comments. I usually keep .js files outside of EE and just refer to them as usual.
December 26, 2007
Hello! Your EE tutorials are a total GODSEND. I finally feel confident that I can purchase an EE license now. I was on the fence after several weeks of reading. I’m 1-week into the 30-day trial, and without your help, I think I would’ve given-up.
Ellis obviously knows the value you’ve provided to the EE community.
December 27, 2007
Thanks Alan - glad to know you’re finding them useful.
December 31, 2007
I’m having a bit of a different issue.
My tutorial site should be at:
http://ee.jonsnetwork.com/index.php/bns/index
but that just goes straight to the default site template. This is still a core installation.
December 31, 2007
Good news, and bad news…
The good news I was able to bring up your site:
http://ee.jonsnetwork.com/index.php?/bns/
By adding the ? question mark to create the query string.
The bad news it might mean you have to turn on force query strings in the EE control panel, not really sure about that, but it’s not uncommon especially on IIS or Windows servers.
IF you do it’s not a big deal, but sometimes you have to change some of the other link parameters because of it.
Search “force query string”, without the quotes on the EE forums, and you’ll find some discussion.
I’m sure Michael can tell you more.
December 31, 2007
Almost forgot, Happy New Year all, or HNY, if you prefer the acronym.
January 01, 2008
Thanks Tygos. It’s on a shared Linux server though. Strange.
January 01, 2008
Hi Jon: Have you stumbled across this kb entry? Take a look-see there and see if there’s anything that helps your install.
January 01, 2008
yes, I did see that kb article. Thanks. Midphase doesn’t support path_info since they run php as a cgi script. The orig_path_info workaround didn’t work. Query strings aren’t an option for me(although forcing them worked). I tried to do cgi.fix_pathinfo like Midphase suggested and that didn’t work either. So Midphase is out. I was having issues with them anyway since they wouldn’t let me trackback when I use the weblog api either. I’ll test on my media temple account since I have stuff running there, otherwise, I’ll probably just sign on with enginehosting. Thanks for your help.
January 15, 2008
FYI: The Building an ExpressionEngine Site series is now available for purchase as an eBook on the newly-launched Train-ee.com.
January 28, 2008
Can you help? The link in the first tutorial to the all important template archive ( http://www.free-css-templates.com/demo/green-business/ ) resolves to ‘The page cannot be found’.
January 28, 2008
See latest blog post..
February 05, 2008
I must be confused. When I replace “image” with “{site_url}images” in my css file, it messes up the curly brackets in my css. What am I doing wrong?
Also, there are a number of semicolons missing from the ends of the css lines. Is there some reason for this?
February 05, 2008
Bill, W3C standards do not require the last line in a css class to end in a semicolon. Personally I always use them in css I need to add anything and forget to close.
For the images did you try adding a slash? “{site_url}/images”
February 05, 2008
Oh hang on I misread that - {} in css might not work.
February 05, 2008
If you are using some sort of editor it may be messing up the curly braces, thinking it’s fixing your code. There may be a setting you would tweak so it wouldn’t argue with it.
I think I’m planning to leave my CSS as normal css just in a CSS folder, because I’m never happy with it, as a finicky designer type. It would be easier to save live to the site, and not have to save it up to a database.
Not sure, but that’s my thinking now.
As Michael says in the book his is one way, depends on many circumstances, and your work flow.
February 05, 2008
Sorry let me add something here:
Especially during development, I think it’s a good idea for me to leave the CSS separate. It could always be added to the database using these methods at a later phase of development.
During site design, the site CSS needs to be as accessible as possible to the designer, so that’s where the choice comes in… how would you prefer to access the css files.
February 05, 2008
Bill - Of course curly brackets around your {site_url} will not work because the css is using curly brackets already! So you are in effect opening and closing another declaration inside your css - however EE does some interesting things IF it knows its a css file its linking too. Worth doing some research on the EE site about this. However TY has it spot on - make it easy for yourself and just put root paths in for your images. I keep all my css images away from other images in an asset folder at root level which means the path will be - “/assets/image.jpg”.
February 05, 2008
Uh, I beg to differ.
I use {site_url} all throughout my css files - it works well to avoid having to change the paths when a site goes live.
body {background: #FFFFFF url({site_url}images/interface/building_series/topbg.jpg) repeat-x top;
font-family: Tahoma, Verdana, Arial, sans-serif;
font-size: 10pt;
color: #454545;
}
I’m wondering if you’re missing one somewhere so it’s not matching them up.
February 05, 2008
But I think it only works if you set up your links to the css using the EE method rather than a standard URL so that EE knows to parse any variables in it - or something. I know I had problems getting my head around something on this very topic last year. There you go Mike - a quick video tutorial subject!
February 05, 2008
Good point Simon, the CSS would have to be an EE template in order to use the site_url variable.
If you aren’t putting your CSS into EE, then that part of the tutorial won’t work.
February 05, 2008
Thanks Mike, Simon, Ty for taking the time to respond.
The last two posts hit it right on the head. I was looking at the css file in Dreamweaver when it appeared that my curly brackets where messing up. Not knowing how EE works, I didn’t realize this is not a problem once you cut and paste the css into the EE template.
Also, Simon, I didn’t realize the semicolon wasn’t required to close a line. Thanks for enlightening me.
Mike, Thank you for putting together this tutorial. I am coming from a design background and have to work extra hard to get the coding/technical part of web design. I know I will come out with a solid understanding of how EE works once I have completed it. The EE documentation hasn’t been enough for me.
I do have a small suggestion that might make this section easier to understand (for others like me). It might be easier for a newcomer to EE to get the {site_url} thing if you included the whole line in the example you give at the end (as you did above). (I wasn’t sure if I needed to keep the “url” at the beginning.)
Like so:
“background: #FFFFFF url({site_url}images/interface/building_series/topbg.jpg) repeat-x top;”
Perhaps this reveals my lack of experience with css, but I’m sure there are others out there who are new to variables, parameters and other terms that come along with developing dynamic sites.
Thanks again
February 05, 2008
Bill - only the last line does not require a semicolon!! At some point we have all been in the position you are in now - not knowing much about EE and not knowing everything about CSS so don’t worry!
February 05, 2008
Simon,
That’s kind of you to say. I’ve been banging my head for two years trying to learn computer languages (html/css/php)-- which is what has lead me to EE as a possible solution-- and it’s good to hear that I’m not alone. It’s also encouraging to get such quick responses when I ask a question.
Looking forward to reading your future posts.
February 05, 2008
URL’s in a css file, maybe not an EE css file, as I’m not sure how EE parses the CSS from the database, are relative.
Meaning if your css is at the root of your domain then a root slash, or a path beginning with /CSS the code would find your css file and any file you point it at. Then in the external CSS stylesheet just using a url of img/imageName would find the images in a folder called img in the CSS directory.
That’s how I’ve been working once I figured out that CSS is relative to where the css is located in the web directory.
It’s a pretty good way to keep track of images that are only being referred to by CSS methods. Clear as mud?
IF you are struggling with the EE concepts at all you will find plenty of information on CSS standards out there.
February 06, 2008
Thanks again, Ty. That does help.
February 06, 2008
Hello Again,
It seems that my images are not being pulled in when I render the index template. Listed below are my css and html image paths and my css link. I would appreciate any help. (I am using the 30-day trial and uploaded my images through the “upload file” button on the “Publish” page.)
CSS
background: #FFFFFF url {site_url}images/topbg.jpg) repeat-x top;
HTML
{site_url}images/img2.gif
STYLESHEET LINK
<link rel="stylesheet" type="text/css" media="screen" href="{stylesheet=building_series/stylesheet}" />
RENDERED INDEX TEMPLATE WITH ROOT PATH
http://demo.expressionengine.com/WGG4L02LMS/images/img2.gif
February 06, 2008
Bill - as you have loaded up the images using the EE internal upload function, your paths will need to include the directory where you have actually placed them. This default for EE is normally an uploads directory in the images directory.
So you need to change:
background: #FFFFFF url {site_url}images/topbg.jpg) repeat-x top;
to
background: #FFFFFF url {site_url}images/uploads/topbg.jpg) repeat-x top;
And we can see that image here:
http://demo.expressionengine.com/WGG4L02LMS/images/uploads/topbg.jpg
February 06, 2008
Thanks Simon - you were just *that* much quicker than me this AM...
February 06, 2008
I have been up longer than you
February 06, 2008
If anyone wants to place there CSS at the root of their site, tried explaining this afraid it wasn’t too clear.
1. create a directory at the root of your site named css.
2. create another directory for the images call it img.
3. The path to use in your stylesheets would then be:
body {
background: #FFFFFF url(/css/img/interface/topbg.jpg) repeat-x top;
For example, it’s maybe not dynamic as the other EE method, but your web site root is always just that, and you can just place all of your CSS there, and if you placed it in another web the root directory still works.
I’ld really like to know how many long time developers use these EE methods, I’m awfully curious, not that it’s a bad thing either?
February 06, 2008
Oops dang Scratch that it’s early, then you only need to use:
body {
background: #FFFFFF url(img/interface/topbg.jpg) repeat-x top;
When the CSS is in the root CSS folder it is relative, so the /css isn’t required, just begin the path with img/
Nothing new here really.
February 06, 2008
Hey Ty -
The only issue that *might* crop up from that is that it’s still a relative path, and that might cause issues from templates that appear “deeper” to the web server than the path assumes.
For example, if the current template is /ee/products/detail/product_name_here/ I’m not sure your path will work the same as /ee/products/detail/, or if the relative path would then have to be more like ../../css/img/interface/topbg.jpg.
I recall having issues trying to use relative paths with EE so have just learned to always use full paths using the site_url variable.
If you want your CSS outside of EE then you’ll have to experiment with the paths to see if the above will work, or if you’ll need to hardcode the full path in.
Just remember to update that if the site URL changes as part of the go-live process.
February 06, 2008
Hi, Still no luck pulling in my images. I know my css file is linked correctly because, when I make changes to it, they are reflected in the rendered template. But, still no images.
My code:
CSS
background: #FFFFFF url ({site_url}images/uploads/topbg.jpg) repeat-x top;
HTML
{site_url}images/uploads/img2.gif
thanks again
February 06, 2008
Bill - looks like you have it sorted - I guessed your site URL and can see it - with all the css background images in place. i can only see one image missing and that is img.jpg in the first content paragraph - again its missing the /upload/ directory in the path. Your getting there!
February 07, 2008
Simon,
Thank you so much for checking in on me. I was hung up because I had a space after “url” and I needed to ad “uploads” to the pathway to my images because it is the default folder when using the hosted trial. A kind observer pointed the extra space out to me in the EE forums.
I learned a big lesson about validating code as a first step to problem-solving.
I hope I can be as helpful to other newcomers once I get the hang of this. The EE community has blown me away so far with their willingness to help.
February 16, 2008
help me plzzz in this
http://www.j-nom.com/index.php/x/index/
what’s problem ???
February 17, 2008
Jawad - the path to your style sheet is wrong. Either your style sheet is not saved as a stylesheet in EE or your code linking to teh style sheet in eth head tag is incorrect. The source code of your page shows that you are trying to get eth css from http://www.j-nom.com/index.php?css=stylesheet which is not a correct path in EE - in fact your css is here http://www.j-nom.com/index.php/stylesheet - check your paths.
February 18, 2008
Simon - thanx alot my dear
i have written it like a hard-coded
<link rel=’stylesheet’ type=’text/css’ media=’all’ href=’http://www.j-nom.com/index.php/x/stylesheet’ />
and it works !!
still i have no idea why
<link rel="stylesheet" type="text/css" media="screen" href="{stylesheet=stylesheet}" />
doesn’t work with me :(
NOW i can move to the next chapter
March 22, 2008
Hi, I am having a nightmare with this stylesheet, I know there is a lot of posts already but I cant see anything parsing like this is when I view the rendered page:
link rel=âstylesheetâ type=âtext/cssâ media=âscreenâ href=âhttp://localhost:8888/bud_design/index.php?css=demo/stylesheet.v.1206230807â
?
March 23, 2008
Those odd characters would suggest where your problem might be. ’ should be a “ you need to retype the code to this:
rel="stylesheet" type="text/css" media="screen" href"http://localhost:8888/bud_design/index.php?css=demo/stylesheet.v.1206230807"
March 23, 2008
Whoops - missed out an =
rel="stylesheet" type="text/css" media="screen" href="http://localhost:8888/bud_design/index.php?css=demo/stylesheet.v.1206230807"
March 24, 2008
Simon
Got it working to an extent now, the menu tabs dont seem to render correctly - the green background isn’t repeating, might be some image URLs i need to correct. But atleasst the style sheet is pulling in and those odd characters are not rendering. I think it is a single quote mark issue, i am running MAMP on my Macbook - dont know if apache is weird about it.
I manually typed it instead of copy+paste and it worked - but whats the deal with the v.XXXXXX that appears afterwords?
March 24, 2008
Patrick - I have not seen this before “stylesheet.v.1206230807”. My guess is that it could be a copy and paste issue again or you have picked up a version number but why I know not why. Either way my suggestion is you change the stylesheet reference to match your stylesheet template name. On the test site I built following this tutorial I used the following:
<link rel="styleshee