XML 'Select Where' Statement - php

I wonder whether someone may be able to help me please.
I'm using Aurigma's 'Image Uploader' software to allow users to add, and view images for the records they create with the image data collected and retrieved via an XML file.
One of the pages I've put together creates a gallery which allows the user to view the images, both individually and as part of a 'fancybox' slideshow. The script for this is shown below.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
$galleryPath = 'UploadedFiles/';
$thumbnailsPath = $galleryPath . 'Thumbnails/';
$absGalleryPath = realpath($galleryPath) . DIRECTORY_SEPARATOR;
$descriptions = new DOMDocument('1.0');
$descriptions->load($absGalleryPath . 'files.xml');
?>
<head>
<title>Gallery</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="Libraries/fancybox/jquery.fancybox-1.3.1.css" rel="stylesheet" type="text/css" />
<link href="Styles/style.css" rel="stylesheet" type="text/css" />
<!--[if IE]>
<link href="Styles/ie.css" rel="stylesheet" type="text/css" />
<![endif]-->
<script src="Libraries/jquery/jquery-1.4.3.min.js" type="text/javascript"></script>
<script src="Libraries/fancybox/jquery.fancybox-1.3.1.pack.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() { $('a.fancybox').fancybox(); });
</script>
<style type="text/css">
<!--
.style1 {
font-size: 14px;
margin-right: 110px;
}
.style4 {font-size: 12px}
-->
</style>
</head>
<body style="font-family: Calibri; color: #505050; font-size: 9px; border-bottom-width: thin; margin-top: 5px; margin-left: -475px; margin-right: 1px; margin-bottom: -10px;">
<div align="right" class="style1"> <a href = "imagefolders.php" /> View Uploaded Images In Folder Structure <a/> ← View All Uploaded Images </div>
<form id="gallery" class="page">
<div id="container">
<div id="center">
<div class="aB">
<div class="aB-B">
<?php if ('Uploaded files' != $current['title']) :?>
<?php endif;?>
<div class="demo">
<div class="inner">
<div class="container">
<div class="gallery">
<ul class="gallery-image-list">
<?php for ($i = 0; $i < $descriptions->documentElement->childNodes->length; $i++) :
$xmlFile = $descriptions->documentElement->childNodes->item($i);
$name = htmlentities($xmlFile->getAttribute('originalname'), ENT_COMPAT, 'UTF-8');
$description = htmlentities($xmlFile->getAttribute('description'), ENT_COMPAT, 'UTF-8');
$folder = htmlentities($xmlFile->getAttribute('folder'), ENT_COMPAT, 'UTF-8');
$source = $galleryPath . rawurlencode($xmlFile->getAttribute('source'));
$thumbnail = $thumbnailsPath . rawurlencode($xmlFile->getAttribute('thumbnail'));
?>
<li class="item">
<a class="fancybox" target="_blank" rel="original" href="<?php echo $source; ?>"><img class="preview"
alt="<?php echo $name; ?>" src="<?php echo $thumbnail; ?>" /></a> </li>
<li class="item"></li>
<p><span class="style4"><b>Image Description:</b> <?php echo htmlentities($xmlFile->getAttribute('description'));?> <br />
<b>Image contained in folder:</b> <?php echo htmlentities($xmlFile->getAttribute('folder'));?> </span><br />
<?php endfor; ?>
</li>
</p>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="aB-a"> </div>
</div>
</div>
</div>
</form>
</body>
</html>
What I'd like to be able to do is now make the images that are retrieved, user specific, i.e. User A can only view their images.
If this information was being retrieved straight from a mySQL database I know that within PHP I can use the 'SELECT WHERE' statement to filter the returned records, but could someone tell me please is there an XML equivalent that I could use?
Many thanks

Allowing users to view only their own uploaded images is not such a simple task. If the images are stored in a publically accessable folder then anybody can view the images using their browser.
To achieve this there are a few alternatives such as:
storing the images in the database rather than the filesystem,
creating a new foler for each user on the filesystem and changing
the read write permissions for each folder, or
storing the images outside the web root and fetching the images
using php i.e.
Instead of providing a link to an image. Provide a link to a cgi
script which will automatically provide the proper header and
content of the image.
For example: image.php?sample.jpg
You can then make sure they are already authenticated (e.g. pass a
session id) as part of the link.
This would be part of the header, and then your image data can
follow.
<?php
$file = basename(urldecode($_GET['file']));
$fileDir = '/path/to/files/';
if (file_exists($fileDir . $file))
{
//perform some authorisation check
...
...
// Note: You should probably do some more checks
// on the filetype, size, etc.
$contents = file_get_contents($fileDir . $file);
// Note: You should probably implement some kind
// of check on filetype
header('Content-type: image/jpeg');
echo $contents;
}
?>

Related

Body background sourced from PHP variable

So I'm trying to set the body background tag to a php variable I created, however I can't get it to correctly work.
Here is the simple PHP:
<?php
$backGround = "images/backgrounds/grey.png";
?>
and here is the HTML I tried which none worked.
<body background="<?php echo $backGround; ?>">
<body background="<?php echo htmlspecialchars($backGround); ?>">
I found these from preview stack overflow questions but they were about setting PHP variables to image sources. I would have thought it would apply to this as well.
Here's my entire PHP page using some of the suggestions but yet to still work.
<?php
$backGround = "images/backgrounds/grey.png";
?>
<html>
<head>
<title>Exodus</title>
<link rel=StyleSheet href="styles/main.css" type="text/css" media=screen>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- Google Fonts -->
<link href='https://fonts.googleapis.com/css?family=Quicksand' rel='stylesheet' type='text/css'>
<!-- JS Scripts -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript" src="assets/fader.js"></script>
</head>
<body style= 'background-image: url("<?php echo $backGround; ?>")'>
<div class="pre-wrap">
<div id="container">
<img src="images/logo.png" id="logo" alt="Pre Logo" style="display: none; margin: 0 auto;" />
</div>
</div>
<div class="wrap">
<p>Test</p>
</div>
</div>
</body>
First of all - using backgound attribute is not recommended by W3C.
What you really need is inline style:
<body style="background-image: url('<?php echo $backGround; ?>')">
check this it will work
<body style= 'background-image: url("<?php echo $backGround; ?>")'>
<body style= 'background-image: url("<?php echo htmlspecialchars($backGround); ?>")'>

fancyBox Gallery

I wonder whether someone may be able to help me please.
Firstly I apologise for what most may feel is a really simple question. But this is my first attempt so please bear with me.
I'm using the script below to create an Image Gallery with Fancybox.
UPDATED CODE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Gallery</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<script type="text/javascript" src="fancybox/jquery.easing-1.4.pack.js"></script>
<script type="text/javascript" src="fancybox/jquery.easing-1.4.pack.js"></script>
<script type="text/javascript" src="fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
<script type="text/javascript" src="fancybox/source/helpers/jquery.fancybox-buttons.js?v=1.0.2"></script>
<script type="text/javascript" src="fancybox/source/helpers/jquery.fancybox-media.js?v=1.0.0"></script>
<script type="text/javascript" src="/fancybox/source/helpers/jquery.fancybox-thumbs.js?v=2.0.6"></script>
<link rel="stylesheet" href="fancybox/source/helpers/jquery.fancybox-buttons.css?v=1.0.2" type="text/css" media="screen" />
<link rel="stylesheet" href="fancybox/jquery.fancybox-1.3.4.css" type="text/css" media="screen" />
<link rel="stylesheet" href="fancybox/source/helpers/jquery.fancybox-thumbs.css?v=2.0.6" type="text/css" media="screen" />
<script type="text/javascript">
$(document).ready(function() {
$("a.fancybox-thumb").fancybox({
'transitionIn' : 'elastic',
'transitionOut' : 'elastic',
'speedIn' : 600,
'speedOut' : 200,
'overlayShow' : false
});
});
</script>
</head>
<body style="font-family: Calibri; color: #505050; font-size: 9px; border-bottom-width: thin; margin-top: 5px; margin-left: 100px; margin-right: 100px; margin-bottom: -10px; float: left; position: absolute;">
<div align="right" class="style1"> <a href = "javascript:document.gallery.submit()"/> Add Images <a/> ← View Uploaded Images </div>
<form id="gallery" name="gallery" class="page" action="index.php" method="post">
<?php for ($i = 0; $i < $descriptions->documentElement->childNodes->length; $i++) :
$xmlFile = $descriptions->documentElement->childNodes->item($i);
$name = htmlentities($xmlFile->getAttribute('originalname'), ENT_COMPAT, 'UTF-8');
$description = htmlentities($xmlFile->getAttribute('description'), ENT_COMPAT, 'UTF-8');
$source = $galleryPath . rawurlencode($xmlFile->getAttribute('source'));
$thumbnail = $thumbnailsPath . rawurlencode($xmlFile->getAttribute('thumbnail'));
?>
<a class="fancybox-thumb" rel="allimages" href="<?php echo $source; ?>"><img src="<?php echo $thumbnail; ?>" alt="<?php echo $name; ?>"/></a><?php endfor; ?>
</form>
</body>
</html>
I can view the images, but I just can't seem to get the gallery functionality working. I've been working through the examples on the 'fancyBox' and 'fancyApps'websites, but clearly I've misunderstood something along the way.
I feel that once I get started I can format the page as I need it to look, I'll just working through the tutorials. But I just wondered if someone could perhaps please show me where I've gone wrong in creating the initial gallery.
Many thanks and regards
I're attaching your fancybox to a class called ".fancybox-thumb", yet there is no such class on the page. Instead, your links bear class called ".images"
So try replacing this line
<a class="images" rel="allimages" href="<?php echo $source; ?>"><img src="<?php echo $thumbnail; ?>" alt="<?php echo $name; ?>"/></a><?php endfor; ?>
with
<a class="fancybox-thumb" rel="allimages" href="<?php echo $source; ?>"><img src="<?php echo $thumbnail; ?>" alt="<?php echo $name; ?>"/></a><?php endfor; ?>
I haven't tested your code but that's one obvious mistake I found so far.
After the initial issues raised by #kernelpanic, #ryan and #Mr_DeLeTeD were rectified, through further testing and having looked through the documenation, the 'grey vertical stripe' was the opacity setting and not an error.

Pass Session Variable From One Form to Another With Link

I would whether someone can help me please.
I have the following test form ('form.html'), which if I use a 'Submit Button' I can pass the 'username' and 'locationid' variables to the next form, in this case 'gallery.php'
<form method="post" action="gallery.php"><br/><br/>
<input type="text" name="username" value="IRHM73" /><br/><br/>
<input type="text" name="locationid" value="1" /><br/><br/>
<input type="submit" name="submit"/><br/><br/>
</form>
and this is the 'gallery.php'
<?php
$_SESSION['username']=$_POST['username'];
$_SESSION['locationid']=$_POST['locationid'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
$galleryPath = 'UploadedFiles/' . $_SESSION['username'] . '/' . $_SESSION['locationid'] . '/';
$thumbnailsPath = $galleryPath . 'Thumbnails/';
$absGalleryPath = realpath($galleryPath) . DIRECTORY_SEPARATOR;
$descriptions = new DOMDocument('1.0');
$descriptions->load($absGalleryPath . 'files.xml');
?>
<head>
<title>Gallery</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="Libraries/fancybox/jquery.fancybox-1.3.1.css" rel="stylesheet" type="text/css" />
<link href="Styles/style.css" rel="stylesheet" type="text/css" />
<!--[if IE]>
<link href="Styles/ie.css" rel="stylesheet" type="text/css" />
<![endif]-->
<script src="Libraries/jquery/jquery-1.4.3.min.js" type="text/javascript"></script>
<script src="Libraries/fancybox/jquery.fancybox-1.3.1.pack.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() { $('a.fancybox').fancybox(); });
</script>
<style type="text/css">
<!--
.style1 {
font-size: 14px;
margin-right: 110px;
}
.style4 {font-size: 12px}
-->
</style>
</head>
<body style="font-family: Calibri; color: #505050; font-size: 9px; border-bottom-width: thin; margin-top: 5px; margin-left: -476px; margin-right: 1px; margin-bottom: -10px;">
<div align="right" class="style1"> <a href = "imagefolders.php" /> View Uploaded Images In Folder Structure <a/> ← View All Uploaded Images </div>
<form id="gallery" class="page">
<div id="container">
<div id="center">
<div class="aB">
<div class="aB-B">
<?php if ('Uploaded files' != $current['title']) :?>
<?php endif;?>
<div class="demo">
<input name="username" type="text" id="username" value="IRHM73" />
<input name="locationid" type="text" id="locationid" value="1" />
<div class="inner">
<div class="container">
<div class="gallery">
<ul class="gallery-image-list">
<?php for ($i = 0; $i < $descriptions->documentElement->childNodes->length; $i++) :
$xmlFile = $descriptions->documentElement->childNodes->item($i);
$name = htmlentities($xmlFile->getAttribute('originalname'), ENT_COMPAT, 'UTF-8');
$description = htmlentities($xmlFile->getAttribute('description'), ENT_COMPAT, 'UTF-8');
$folder = htmlentities($xmlFile->getAttribute('folder'), ENT_COMPAT, 'UTF-8');
$source = $galleryPath . rawurlencode($xmlFile->getAttribute('source'));
$thumbnail = $thumbnailsPath . rawurlencode($xmlFile->getAttribute('thumbnail'));
?>
<li class="item">
<a class="fancybox" target="_blank" rel="original" href="<?php echo $source; ?>"><img class="preview"
alt="<?php echo $name; ?>" src="<?php echo $thumbnail; ?>" /></a></li>
<p><span class="style4"><b>Image Description:</b> <?php echo htmlentities($xmlFile->getAttribute('description'));?> <br />
<b>Contained in folder:</b> <?php echo htmlentities($xmlFile->getAttribute('folder'));?> </span><br />
<?php endfor; ?>
</li>
</p>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="aB-a"> </div>
</div>
</div>
</div>
</form>
</body>
</html>
I'm now trying to perform the same action but this time via a link rather than a button.
I've not changed my 'gallery.php script, but my revised form is as follows:
<?php
session_start();
$_SESSION['username']="username";
$_SESSION['locationid']="locationid";
echo 'Gallery';
?>
<input type="text" name="username" value="IRHM73" /><br/><br/>
<input type="text" name="locationid" value="1" /><br/><br/>
</form>
However when I load the form I receive the following error:
Warning: session_start() [function.session-start]: Cannot send session
cache limiter - headers already sent (output started at
/homepages/2/d333603417/htdocs/development/form.php:2) in
/homepages/2/d333603417/htdocs/development/form.php on line 3
I'm not too familiar with 'Session variables' as I'm only just learning. But I just wondered whether someone could perhaps take a look at this and let me know where I'm going wrong.
Many thanks and regards
Put the following:
session_start();
at the top of gallery.php, not form.html. Also, You cannot submit a form that way unless you use javascript to submit the form upon click of a link, see here: http://www.javascript-coder.com/javascript-form/javascript-form-submit.phtml. Also, you have no opening < form> tag on your form.
session_start() should be called before any output to the browser, so put it before anything is sent. The output is sent from the form.php file.
It seems like somewhere in your php pages you have the session_start(); call after other operations (like print hmtl).
Put always session_start() as the first instruction in php pages

Align image img with text in box

EDIT: This works now thanks to ' olly_uk '
EDIT2: It works now, but the alignment of the boxes is wrong. You can view a screenshot HERE. Without any text it will align perfectly with 2 boxes on each line at a perfect distance from each other, but with text it echo's it under each other. Why?
I am trying to echo a image, then in that image I want to echo text from a database.
Well it echo's the images (3, because I only have 3 product examples in the database), but the products are not aligned in the boxes. It comes under it. I have searched on google but could not find anything
Is it even possible to use e.g. margin-top to move the posted echo so I could align it in the box?
I want to use style or class in the PHP...
Example image: IMAGE
adding <style>p{...};h3{...};</style> worked
Code sample
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>BOX</title>
<link href="includes/style.css" rel="stylesheet" type="text/css" />
<link rel="icon" href="./favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
<style>
p {
position:relative;
top:-240px;
left:180px;
}
h3 {
position:relative;
top:-270px;
left:30px;
}
</style>
</head>
<?php
include 'includes/connection.php';
$query = "SELECT * FROM products";
$result = mysql_query($query);
?>
<body>
<div class="header navpos c1" id="nav">
<table summary="header" border="0">
<tr>
<td>
<ul>
<li class="home"></li>
</ul>
</td>
<td>
<ul>
<li class="about"></li>
</ul>
</td>
<td>
<ul>
<li class="contact"></li>
</ul>
</td>
<td>
<ul>
<li class="twitter"><img src="includes/images/f_logo.png" alt="** PLEASE DESCRIBE THIS IMAGE **" /></li>
</ul>
</td>
<td>
<ul>
<li class="facebook"><img src="includes/images/t_logo.png" alt="link to Syndicate Plus Twitter" /></li>
</ul>
</td>
</tr>
</table>
</div>
<div class="offers">
<div class="content_box">
<?php
while($products = mysql_fetch_array($result)) {
echo '<img src="includes/images/content_box.png" border=0 />';
echo "<h3>" . $products['products'] . "</h3>";
echo "<p>" . $products['description'] . "</p>";
}
?>
</div>
</div>
</body>
</html>
i think you could achieve this using CSS. by having a negative top to bump the text over the top of the image. will try to give some example code when i get home.
check this out in the mean time, w3schools CSS-positioning
hope that helped
EDIT: added code to show what i mean
<html>
<head>
<title>text over image</title>
<style>
p {
position:relative;
top:-200px;
}
h2 {
position:relative;
top:-140px;
}
</style>
<head>
<body>
<img src="/images/office1.jpg" alt="demo image"/>
<h2>test text</h2>
<p>test desciption text</p>
<hr/>
<img src="/images/office1.jpg" alt="demo image"/>
<h2>test text</h2>
<p>test desciption text</p>
</body>

Document Name within a PHP include

I have 16 Documents with a php include in them to include a php template like this:
<?php include("templates/template.php"); ?>
Inside that template there is a little bit of PHP which finds the document name and prints it. The problem is that for the php document to be included its PHP is processed (Naturally because its PHP), this means that the document name finder is finding the name of the template and not the main document. What I am trying to do is have 16 PHP Files which act as a front end and are accessed by the User, these files include the Template file which finds the name of the accessed file and pulls html code from another file into the body of the template. This means that the content for the file is external to the Structure of the site and allows a level of simplicity for basic editing (I.E. The client can edit their website). As I stated above my method has a simple problem what I am trying to figure out is if anyway knows how to do this.The Template file is pasted below
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<script src="http://code.jquery.com/jquery-1.5.2.min.js" type="text/javascript">
</script>
<link href="css/styles.css" rel="stylesheet" type="text/css" />
<script type="text/JavaScript">
<!--
var screenwidth = screen.width;
if (screenwidth < 1180){
document.write('<link rel="stylesheet" href="css/ldrop.css" type="text/css" media="screen" />');
}
else
{
document.write('<link rel="stylesheet" href="css/drop.css" type="text/css" media="screen" />');
}
// -->
</script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Alignment Courses</title>
<link rel="shortcut icon" href="favicon.png" />
</head>
<body onload="makerequest('templates/quote.php','quote'); return false;makerequest('editing/<?php echo basename(__FILE__, '.' . pathinfo(__FILE__, PATHINFO_EXTENSION)); ?>.php','main')">
<div id="menu"><img src="webpics/logo.png" width="225" height="150" onmouseover="this.src='webpics/logoinv.png'" onmouseout="this.src='webpics/logo.png'" style="float:left" alt="Exit To Banner"/>
<div id="logo"><a href="index.html"><img src="webpics/Yoga Health.png" alt="Yoga Health Townsville" width="458" height="43" vspace="20"
onmouseover="this.src='webpics/Yoga Health Inv.png'"
onmouseout="this.src='webpics/Yoga Health.png'"/></a>visit the photo gallery</div>
<div id="nav" class="mainmenu">
<ul>
<li class="menu1">Home</li>
<li class="menu2">Classes
<ul>
<li>Daily</li>
<li>Beginner</li>
<li>Alignment</li>
<li>Preparation</li>
</ul>
</li>
<li class="menu3">Family Yoga
<ul>
<li>Family Yoga</li>
<li>Childrens Yoga</li>
<li>Prenatal Yoga</li>
</ul>
</li>
<li class="menu4">Prices
<ul>
<li>Classes</li>
<li>Equipment</li>
</ul>
</li>
<li class="menu5">Events/Workshops
<ul>
<li>Dance</li>
</ul>
</li>
<li class="menu6">Our Teachers</li>
<li class="menu7">Location</li>
</ul>
</div></div>
<div id="content"><div id="sidebar"><div id="sidebar">
<p><strong class="MyriadPromain"><em>Contacts</em></strong><br />
<span class="MyriadProcontact">Shop 3, 262 Woolcock Street, Currajong, 4812 <br />
Information: info#yogahealth.net.au<br />
Bookings: bookings#yogahealth.net.au<br />
Phone: 07 47 751 154<br />
Mobile: 0410 085 054<br /><br /></span>
<span class="ArialGroup">For Enquiries Regarding Group Bookings<br />Click Here</span>
</p>
<p><img src="http://www.yogahealth.net.au/webpics/facebook.gif" width="120" height="45" /></p>
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.facebook.com%2Fpages%2FYoga-Health-Townsville%2F140216156034239%23&layout=box_count&show_faces=false&width=700&action=like&font=verdana&colorscheme=light&height=50" scrolling="No" frameborder="0" style="border:none; overflow:hidden; width:65px; height:65px;" allowtransparency="true"></iframe>
<p>
Links to other Websites in our Community</p>
<div class="quoteback">
<img src="http://www.yogahealth.net.au/webpics/Refresh.gif" height="20px" width="20px" align="right" />
<div id="quote"><br \></div>
</div>
<br \>
<script src="http://widgets.twimg.com/j/2/widget.js"></script>
<script>
new TWTR.Widget({
version: 2,
type: 'profile',
rpp: 4,
interval: 6000,
width: 250,
height: 300,
theme: {
shell: {
background: '#333333',
color: '#ffffff'
},
tweets: {
background: '#000000',
color: '#ffffff',
links: '#4aed05'
}
},
features: {
scrollbar: false,
loop: false,
live: false,
hashtags: true,
timestamp: true,
avatars: false,
behavior: 'all'
}
}).render().setUser('YogaHealth1').start();
</script>
<?php include("templates/quotein.php"); ?>
</div>
</div><div id="main"><?php include("editing/alignment.php"); ?></div></div>
<div id="footer"></div>
</body>
</html>
Many Thanks in advance.
Template should be a piece of code, which takes parameters and based on that generates output.
The solution for this problem could be, that in that accessed file, you declare a variable with appropriate name and pass it to the template. There you will have each page differentiated as requested.
Solution:
Magic constant __FILE__ holds name of the included file, if used in include. So the solution is to move php code to the file, from which you are running the include.

Categories