By hinestomato on
Hi,
i am trying to make a drupal theme, its my first one and im just learning PHP as well so please take it easy on me :P
here is my theme how i would like it to show, http://216.147.101.185/sites/all/themes/zoober/mainpage.php.. now i have an exact copy, that i named page.tpl.php and when i set the theme it shows up like this http://216.147.101.185. I started this theme off with a copy of bluemarine but completely cleared all code from page.tpl.php and styles.css.
If anyone has any ideas/comments they would be much appreciated
here is the full code of my header.php
<html>
<head>
<title><?php print $head_title ?></title>
<?php print $head ?>
<?php print $styles ?>
<?php print $scripts ?>
<style type="text/css">
input.colorbuttons {
height:12px;
width:12px;
}
table.headerBG {
background:url(images/headerBGblue.jpg);
}
#cchanger {
float: right;
margin: 4px 10px 0 0;
}
h1#site-name {
margin: 0 0 10px 20px;
color: white;
}
</style>
</head>
<body>
<table class="headerBG" width="800" height="150" align="center" cellpadding="0" cellspacing="0" border="0">
<tr height="30">
<td valign="top">
<?php include 'cchanger.php' ?>
</td>
</tr>
<tr height="84">
<td valign="bottom">
<h1 id="site-name">Drupaltest.com</h1>
</td>
</tr>
<tr>
<td>
<?php if (isset($primary_links)) { ?><?php print theme('links', $primary_links, array('class' => 'links', 'id' => 'navlist')) ?><?php } ?>
</td>
</tr>
</table>
</body>
</html>
Comments
full path
In general, any HTML or PHP code calling for images should have the full path. In your CSS (if in a separate CSS page) you can use images/myimage.jpg or whatever.
The full path should be:
/sites/all/themes/your_theme/images/your_image.jpg
*
*
WOW
that worked!, thank you very much i didnt think it was going to be that easy! :D:D
hmm
Ok, now its working and all but as soon as i click a link to go to a page it screws up my header.. am i supposed to use a specific place/variable for putting my header? you can see the page here http://216.147.101.185/
You forgot the forward slash
You forgot the forward slash at the beginning of the path to the image - Xira has it right but you copied wrong.
Does that include actually work?
You should put the file to be included in your theme folder and use this:
Pimp your Drupal 8 Toolbar - make it badass.
Adaptivetheme - theming system for people who don't code.
ty
tyvm jmburnz, that fixed the image problem. yea the include works, is there a reason it should go in the themes folder?
to keep root tidy, also,
to keep root tidy, also, when you upgrade you risk over writing it. if you want to dump php files in root that's your choice, but certainly not best practice.
Pimp your Drupal 8 Toolbar - make it badass.
Adaptivetheme - theming system for people who don't code.
ok
ok thanks. it just seams odd to put includes in that folder since that would mean multiple themes would be putting includes in the same place
no they wouldnt, each theme
no they wouldnt, each theme would have their included files in their respective folders, like I say its up to you where you put your files...
Pimp your Drupal 8 Toolbar - make it badass.
Adaptivetheme - theming system for people who don't code.
ok
ok, so i have the include in my themes folder, sites/all/themes/zoober, right? thats where it is located
color changer
thanks alot for the help guys,
Does anyone have any ideas why the links do not show up when i change the colors on the top? it changes the page to mainpage.php but the code is the same:
if you notice, it works correctly when you are on "Add Page"
http://216.147.101.185/