I'm building my first site using php. I created a file called 'header.php' which contains my navigation and picture. On my 'index.php' I write inside the div where the header should be placed <?php include_once 'inc/header.php'; ?> now, you can see that the file is included but the pictures don't show and it looks like the div styles aren't working because the place holders for the pictures are in the wrong spot. If you look at 'header.php' by it's self in a browser everything looks fine, pictures are there with styles for containers. What am I missing here? This is my header.php file:
<style type="text/css">
#import url("../site_css/Css_reset.css");
#import url("../site_css/craig-smith.css");
</style>
<div class="picture"><img src="../graphics/header1.gif" />
<div id="nav">
<table style="display: inline-table;" border="0" cellpadding="0" cellspacing="0" width="400">
<!-- fwtable fwsrc="navback_temp.png" fwpage="Page 1" fwbase="nav.jpg" fwstyle="Dreamweaver" fwdocid = "1996150392" fwnested="0" -->
<tr>
<td><img src="../graphics/nav/spacer.gif" width="80" height="1" border="0" alt="" /></td>
<td><img src="../graphics/nav/spacer.gif" width="70" height="1" border="0" alt="" /></td>
<td><img src="../graphics/nav/spacer.gif" width="134" height="1" border="0" alt="" /></td>
<td><img src="../graphics/nav/spacer.gif" width="116" height="1" border="0" alt="" /></td>
<td><img src="../graphics/nav/spacer.gif" width="1" height="1" border="0" alt="" /></td>
</tr>
<tr>
<td><img name="nav_r1_c1" src="../graphics/nav/nav_r1_c1.jpg" width="80" height="40" border="0" id="nav_r1_c1" alt="" /></td>
<td><img name="nav_r1_c2" src="../graphics/nav/nav_r1_c2.jpg" width="70" height="40" border="0" id="nav_r1_c2" alt="" /></td>
<td><img name="nav_r1_c3" src="../graphics/nav/nav_r1_c3.jpg" width="134" height="40" border="0" id="nav_r1_c3" alt="" /></td>
<td><img name="nav_r1_c4" src="../graphics/nav/nav_r1_c4.jpg" width="116" height="40" border="0" id="nav_r1_c4" alt="" /></td>
<td><img src="../graphics/nav/spacer.gif" width="1" height="40" border="0" alt="" /></td>
</tr>
</table>
</div>
</div>
and this is relevant info for index.php
<body>
<div id="body">
<div id="header">
<?php include_once 'inc/header.php'; ?>
</div>
The image paths need to be relative to index.php, not the include file. You need to remove ../ from your <img> paths
Try This :
<?php include_once './inc/header.php'; ?>
Paths should be relative to index.php not header.php. Using dreamweaver to make changes to header.php you need to manually change paths because it will make everything relative to header.php.
Are you sure the paths are correct? What does the file hierarchy look like?
Related
I have content stored in mysql, as following:
<table width="450" cellspacing="1" cellpadding="1" border="1">
<tbody>
<tr>
<td><img width="513" height="680" align="left" alt=" src="/userfiles/image/pic.jpg" /></td>
<td><img width="315" height="700" align="left" alt=" src="/userfiles/image/DSC_0389.JPG" /></td>
<td><img width="580" height="320" align="left" alt=" src="/userfiles/image/ktxh.jpg" /></td>
</tr>
</tbody>
</table>
When I load from db, PHP and display in html by PHP, there is no problem.
Now, I want all images, be displayed by fixed width and height as 200 X 200 AND TABLE BORDER = '0'
<table width="200" cellspacing="1" cellpadding="1" border="0">
<tbody>
<tr>
<td><img width="200" height="200" align="left" alt=" src="/userfiles/image/pic.jpg" /></td>
<td><img width="200" height="200" align="left" alt=" src="/userfiles/image/DSC_0389.JPG" /></td>
<td><img width="200" height="200" align="left" alt=" src="/userfiles/image/ktxh.jpg" /></td>
</tr>
</tbody>
</table>
How do I solve this problem?
Replace with this code and css
<style>
.cstm
{
width:200px;
height:200px
}
table
{
border:0
}
</style>
<table width="200" cellspacing="1" cellpadding="1" border="0">
<tbody>
<tr>
<td><img class="cstm" align="left" alt=" src="/userfiles/image/pic.jpg" /></td>
<td><img class="cstm" align="left" alt=" src="/userfiles/image/DSC_0389.JPG" /></td>
<td><img class="cstm" align="left" alt=" src="/userfiles/image/ktxh.jpg" /></td>
</tr>
</tbody>
</table>
As you mention the $content is dynamic, can you try adding the style to the table as such:
<style>
table td>img
{
width:200px;
height:200px
}
</style>
I want on my site to insert Google Ads on left and right sidebar, but I don't know how to create sidebars.
This is code from my header.php code that i have currently:
<?php
include "config.php";
?>
<html>
<head><meta name="adtictac-site-verification"
content="1qvt6zbzk026xfomo6gxbxxhjk9t96obv58gpcv3n9ver69s0"><meta
name="clckd" content="273a893ce34e0acd4ba2655313b5f902" />
<title><?php echo $sitename; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="styles.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#2C60A9" leftmargin="1" topmargin="0" marginwidth="0"
marginheight="0">
<table width="777" border="2" bgcolor="#ffffff" align="center"
cellpadding="0" cellspacing="0" class="border">
<tr>
<td><img src="images/header.jpg" width="777" height="210" alt=""></td>
</tr>
<tr>
<td background="images/bg.jpg"><table width="100%" border="0"
cellspacing="0" cellpadding="0">
<tr>
<td width="30%"><img src="images/links.jpg" width="231" height="17"
alt=""></td>
<td width="7%"><A href="index.php"><img src="images/home.jpg" width="54"
height="17" alt="" border="0"></a></td>
<td width="11%"><A href="join.php"><img src="images/register.jpg"
width="83" height="17" alt="" border="0"></a></td>
<td width="7%"><A href="faq.php"><img src="images/faq.jpg" width="54"
height="17" alt="" border="0"></a></td>
<td width="12%"><A href="contactus.php"><img src="images/contact-us.jpg"
width="98" height="17" alt="" border="0"></a></td>
<td width="12%"><A href="advertise.php"><img src="images/advertise.jpg"
width="92" height="17" alt="" border="0"></a></td>
<td width="21%"><A href="login.php"><img src="images/login.jpg"
width="49" height="17" alt="" border="0"></a></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td class="bodytext"> </td>
<td> </td>
</tr>
<tr>
<td width="7%"> </td>
<td width="91%" class="bodytext"><p align="justify">
<?php
include "config.php";
$rs=mysql_query("select ID,BannerURL from bannersads where remaining>0 and
approved=1 and adtype=1 order by rand() limit 0,1");
while($arr=mysql_fetch_array($rs)) {
echo "<br><center><a href=$siteurl/tr.php?id=$arr[0] target=_blank><img
src=$arr[1] width=468 height=60 border=0></a><br></center><br>";
$rsu=mysql_query("update bannersads set remaining=remaining-1 where
ID=$arr[0]");
}
?>
So can someone share some tips how to create sidebars where need to create placed like shown in image? I tryed inserting this:
<div class="google">
// Google Code here
</div>
and this CSS:
.google {
margin-left:-250px;
}
but looks like broke my content in my homepage.
.google {
left: 250px;
}
Also create a container and give it width in px, not %.
Let me hope that will solve your problem.
I have made a navbar in photoshop and converted into code using the Save to web function in Photoshop, now the navbar is getting displayed OK, but when I add other stuff code then it just gets out of the page, its width increases.
My navbar.html
<html>
<head>
<title>Couture Collection</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- Save for Web Slices (Untitled-3) -->
<table id="Table_01" width="1366" height="78" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="5">
<img src="images/navbar_01.png" width="1125" height="21" alt=""></td>
<td colspan="2">
<img src="images/navbar_02.png" width="241" height="21" alt=""></td>
</tr>
<tr>
<td>
<img src="images/navbar_03.png" width="180" height="56" alt=""></td>
<td>
<img src="images/navbar_04.png" width="217" height="56" alt=""></td>
<td>
<img src="images/navbar_05.png" width="272" height="56" alt=""></td>
<td>
<img src="images/navbar_06.png" width="207" height="56" alt=""></td>
<td colspan="2">
<img src="images/navbar_07.png" width="414" height="56" alt=""></td>
<td>
<img src="images/navbar_08.png" width="76" height="56" alt=""></td>
</tr>
<tr>
<td>
<img src="images/spacer.gif" width="180" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="217" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="272" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="207" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="249" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="165" height="1" alt=""></td>
<td>
<img src="images/spacer.gif" width="76" height="1" alt=""></td>
</tr>
</table>
<!-- End Save for Web Slices -->
</body>
</html>
1125+241 = 1366 and 180+217+272+207+414+76 = 1366
So if you add another td it will increase your nav and exceed 1366px. Best way should be to use real HTML + CSS to make your navbar instead of generating it with photoshop because it's using fixed width (which is not responsive at all)
I know how to provide or modify a field with CURL curl_setopt function and to work with cookies, but what I could not find is how to modify an HTML element with CURL.
For instance, let's say I want to replace the function "submit_device_form" in below code
<div id="bottombuttons">
<table border="0" cellspacing="0" cellpadding="0" style="width:100%;">
<!-- buttons -->
<tr>
<td> </td>
<td class="separatorButton">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>Set</td>
<td>Cancel</td>
</tr>
</table>
</td>
</tr>
<!-- fixes the width of the first column -->
<tr>
<td style="padding:0;"><img src="images/spacer.gif" alt="" width="200" height="1" border="0" ></td>
<td style="padding:0;"><img src="images/spacer.gif" alt="" width="360" height="1" border="0" ></td>
</tr>
</table>
</div>
with "submit_MY_form", a new JavaScript function included in my PHP script. How would I go for it?
I looked into the "PHP Simple HTML DOM Parser" library since it provides the setAttribute and removeAttribute functions that would allow me to do that easily, but then I miss the info on how to give it access to the page read wia CURL, so I'm stuck.
Thanks for your help,
Robert
in this code i want to add $image variable to td background but i dont know if add it between quotes without any problems..or delete quotes..and how to get it from youtube video..thanks for helping
<table width="130" height="97">
<tbody><tr>
<td valign="center" width="130" align="center" background="showvideo.php_files/2_003.jpg" height="97">
<a href="http://www.mysite.com/video/watch.php?VDCID=42608">
<img src="showvideo.php_files/play_arrow.gif" alt=" Theme Song " border="0">
</a>
</td>
</tr>
</tbody></table>
there you go:
<td valign="center" width="130" align="center" background="<?php echo $image; ?>" height="97"></td>