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>
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 have 5 images. I need to show the images based on the order.
Now I have the order in the array like
2,3,5,1,4
Now my images are in $new->image1,$new->image2,$new->image3,$new->image4,$new->image5
My result should be like if order is as like above,
order is like $new->image2,$new->image3,$new->image5,$new->image5,$new->image1,$new->image4
How can I achieve this
<table style="text-align:justify" align="center" border="1" cellspacing="0" >
{{$new->img_order}}
<?php
$order_array = explode(",", $new->img_order);
$img1 = $new->image2;
dd($new->image2);
?>
<tr>
<td height="600" rowspan="3"><img width="350" height="910px" src="{{asset('collage/'.$new->image1)}}" class="img-responsive" alt=""></td>
<td height="300" colspan="2"><img width="500" height="300px" src="{{asset('collage/'.$new->image2)}}" class="img-responsive" alt=""></td>
</tr>
<tr>
<td width="250" ><img width="250" height="350px" src="{{asset('collage/'.$new->image3)}}" class="img-responsive" alt=""></td>
<td width="250"><img width="250" height="350px" src="{{asset('collage/'.$new->image4)}}" class="img-responsive" alt=""></td>
</tr>
<tr>
<td colspan="2"><img width="500" height="250px" src="{{asset('collage/'.$new->image5)}}" class="img-responsive" alt=""></td>
</tr>
</table>
I just wonder why you not save the image path in array, but with many image1, image2, .....
Without sorting the image, you can echo the image by the order array with
$new->{'image' . $order[0]}
$new->{'image' . $order[1]}
$new->{'image' . $order[2]}
...
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 create a table with HTML to be inserted into TCPDF::writeHTMLCell with this format. The table only contains image.
$html_table ='<table align="right" border="1">
<tr>
<td width="10%" align="center">
<img src="http://localhost/img1.png" width="40" height="40" />
</td>
<td width="10%" align="center">
<img src="http://localhost/img2.png" width="40" height="40" />
</td>
</tr>
<tr>
<td width="10%" align="center">
<img src="http://localhost/img3.png" width="40" height="40" />
</td>
<td width="10%" align="center">
<img src="http://localhost/img4.png" width="40" height="40" />
</td>
</tr>
</table>';
Here's the TCPDF code to create HTMLCell
$pdf->writeHTMLCell(100, '', '', $pdf->getY(), $html_table, 1, 0, 0, false, 'R', false);
Even thought the HTML can show the table at the right side of page, TCPDF only shows this table at the left side inside the cell.
What is the right code to put the table in align right, put in the right side of the HTMLCell ?
I have this css styling and was wondering what I need to change in order to collapse/hide html tables that are empty.
The style:
<style>
#search_settings
{
position:relative;
height:25px;
width:500px;
}
#users_table_results
{
border-collapse:separate;
empty-cells:hide;
}
#events_table_results
{
border-collapse:separate;
empty-cells:hide;
}
#establishments_table_results
{
border-collapse:separate;
empty-cells:hide;
}
</style>
My HTML:
<div id="search_settings">
<table width="500" border="0">
<tr>
<td height="20" class="heading_text_18">Search results</td>
</tr>
</table>
<table id="users_table_results" max-width="500" name="users" border="0">
<tr>
<td width="50" height="50"><a href="#profile.php"><img src="Images/<?php echo $row_result_users['picture_thumb_url']; ?>"
border="0" height="50" width="50"/></a></td>
<td width="150" class="ordinary_text_12"><?php echo $row_result_users['user_first_name']; ?></td>
<td width="150" class="ordinary_text_12"><?php echo $row_result_users['user_last_name']; ?></td>
<td width="150" class="ordinary_text_12"><?php echo $row_result_users['username']; ?></td>
</tr>
</table>
<table id="events_table_results" width="500" name="events" border="0">
<tr>
<td width="50" height="50"><a href="#profile.php"><img src="Images/<?php echo $row_event['event_thumb_url']; ?>"
border="0" height="50" width="50"/></a></td>
<td width="150" class="ordinary_text_12"><?php echo $row_event['event_name']; ?></td>
<td width="150" class="ordinary_text_12"><?php echo $row_event['event_venue']; ?></td>
<td width="150" class="ordinary_text_12"><?php echo $row_event['event_date']; ?></td>
</tr>
</table>
<table id="establishments_table_results" width="500" name="establishments" border="0">
<tr>
<td width="50" height="50"><a href="#profile.php"><img src="Establishment_Images/<?php echo $row_establishment['establishment_thumb_url']; ?>"
border="0" height="50" width="50"/></a></td>
<td width="150" class="ordinary_text_12"><?php echo $row_establishment['establishment_name']; ?></td>
<td width="150" class="ordinary_text_12"><?php echo $row_establishment['location_name']; ?></td>
<td width="150" class="ordinary_text_12"><?php echo $row_establishment['establishment_pricing']; ?></td>
</tr>
</table>
</div>
I would want it such that if there are no results for my events table, the table does not show(there is no blank space between search results where event results should be because border=0). Can you hide entire tables?
Why not wrap the entire table in a PHP if statement and then use that to check for data and display the table or not?
If you wanted to keep your client side HTML free of server side markup and help keep content and behavior 100% separate, you could use JQuery to hide any tables for which there are no row elements found:
$(document).ready( function() {
$('table').each( function() {
if( $(this).find('tr').length == 0 ) {
$(this).hide();
}
});
});
The best method is to use a server side language like to PHP to generate the required table based on the SQL query. This will result in shorter and more effective code.
If you want to achieve this just using css and your existing code, you could create a new css class called hidden_table and set display to none:
.hidden_table {
display: none;
}
Then in your output, you can determine whether to write the css class of the table as your standard class if there are rows, or you can give the table the class "hidden_table" which will hide the entire table.