473,404 Members | 2,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

How to editing a PHP website for a newbie?

Hi,

Basically im editing a gallery for a website, but it has been created using PHP and i have very little knowledge of what it means. All i have to do is add new images to the gallery but seems unnecessarily over complicated. The link to the gallery page i wish to edit looks like this,
<img src=photos/tb_1.jpg /><br /><a href='gallery.php?cid=1'>Adult Cakes</a> I want to find this page that it is linking to, but what is it saved as. I would normally have it has adultcakes.htm for instance.

I want to edit this target link, but i cannot find the target in the filemanager and havnt got a clue as to what to save it as.
Feb 9 '11 #1
7 2297
JKing
1,206 Expert 1GB
gallery.php would be the file name shown.
Feb 10 '11 #2
Thanks for your reply but that doesnt help much. The webpage is http://katieskakes.org.uk/gallery.php and i want to edit the adult cakes link on that page but cannot find it in the file manager and havnt got a clue where to edit it from.
Feb 10 '11 #3
nathj
938 Expert 512MB
Hi,

I would suggest that somewhere there is a gallery.php file and that the file, when you find it, reads the id from the $_GET array and uses that to determine which gallery is being shown.

If you look at your site you and open up the various cake galleries you will see that the url is always gallery.php?cid=x where x is the number of the gallery. In cases where there is no $_GET array present the categories are displayed.

This alone leads me to think that there is a database with images/paths in that you need to edit in order to add new cakes to the gallery. You'll need to find gallery.php to be certain.

Have a hunt around and try to figure out what is going on in gallery.php. When you find it post back if you get stuck following it through.

Cheers
nathj
Feb 10 '11 #4
Hi, yes this is making some sense. Ive noticed this coding you are refering to in the gallery page. Do you reckon i just need to upload the necessary photo's into the correct folder then? and i do not have to tamper with any coding?
Is this line of coding important??

"<img src=".$images_dir.'/tb_'.$row[0].'.jpg'." /><br /><a href='gallery.php?cid=".$row[0]."'>".$row[1]."</a>

Thanks for your help.

####UPDATE####

Ive found the folder where the pictures are located. Now all i want to know is how to edit the necessary gallieries as i dont understand this whole http://www.katieskakes.org.uk/gallery.php?cid=1. How do i edit this page?
Feb 10 '11 #5
nathj
938 Expert 512MB
If you are unsure I recommend a little bit of trial and error. Upload a photo and see if it appears. If it does not then no harm done. you can then read through the code more thoroughly to find out what else you may need to do.

I can't really tell the importance of a single line out of context.

If you need more help post the gallery.php file remember to use code tags
Feb 10 '11 #6
<!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 NAME="TITLE" CONTENT="Katie's Kakes and Sugarcraft">
<META NAME="DESCRIPTION" CONTENT="Katie's Kakes, specialist cakes made to order, equipment sold and tins for hire. See the galleries for some examples of cakes we have made, contact us for a free appointment to discuss your needs. ">
<META NAME="KEYWORDS" CONTENT="cakes sugarcraft cake shop surbiton kingston upon thames specialist made to order katies kakes surbiton art">
<META NAME="AUTHOR" CONTENT="Ben Jarvis">
<META HTTP-EQUIV="CHARSET" CONTENT="ISO-8859-1">
<META HTTP-EQUIV="CONTENT-LANGUAGE" CONTENT="English">
<title>Katie's Kakes | Photo Gallery</title>
<link href="/css/style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="/css/thickbox.css" type="text/css" media="screen" />
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="/js/jquery.cycle.all.min.js"></script>
<script type="text/javascript" src="/js/scripts.js"></script>
<script type="text/javascript" src="/js/thickbox.js"></script>

</head>
<body>
<div>
<div id="container">
<div id="header"><div id="logo"><img src="images/logo.png" alt="Katies Kakes" /></div></div>
<div id="navarea">
<div id="push"></div>
<div id="navigation">
<ul id="topnav">
<li class="home"><a href="index.php"></a></li>
<li class="about"><a href="aboutus.php"></a></li>
<li class="equipment"><a href="equipment.php"></a></li>
<li class="gallery"><a href="gallery.php"></a></li>
<li class="tins"><a href="tins.php"></a></li>
<li class="contact"><a href="contact.php"></a></li>
</ul>
</div>
</div>
<div id="contentarea">
<div id="slideshow">
<ul id="nav">
<li id="prev"><a href="#">Previous</a></li>
<li id="next"><a href="#">Next</a></li>
</ul>
<ul id="slides">
<li><img src="images/slider/slide1.jpg" alt="Harley Davidson Sportster" /></li>
<li><img src="images/slider/slide2.jpg" alt="Harley Davidson Sportster" /></li>
</ul>
</div>
<div id="content">
<br />
<h2>Photo Gallery</h2><br />
Enjoy browsing through the photo galleries, cakes that you see can be adapted to suit your particular ideas and needs. To browse each category, click on the links. <br />
<?php
include("config.inc.php");

// initialization
$result_array = array();
$counter = 0;

$cid = (int)($_GET['cid']);
$pid = (int)($_GET['pid']);

// Category Listing

if( empty($cid) && empty($pid) )
{
$number_of_categories_in_row = 3;

$result = mysql_query( "SELECT c.category_id,c.category_name,COUNT(photo_id)
FROM gallery_category as c
LEFT JOIN gallery_photos as p ON p.photo_category = c.category_id
GROUP BY c.category_id" );
while( $row = mysql_fetch_array( $result ) )
{
$result_array[] = "<img src=".$images_dir.'/tb_'.$row[0].'.jpg'." /><br /><a href='gallery.php?cid=".$row[0]."'>".$row[1]."</a> ";
}
mysql_free_result( $result );

$result_final = "<tr>\n";

foreach($result_array as $category_link)
{
if($counter == $number_of_categories_in_row)
{
$counter = 1;
$result_final .= "\n</tr>\n<tr>\n";
}
else
$counter++;

$result_final .= "\t<td>".$category_link."</td>\n";
}

if($counter)
{
if($number_of_categories_in_row-$counter)
$result_final .= "\t<td colspan='".($number_of_categories_in_row-$counter)."'>&nbsp;</td>\n";

$result_final .= "</tr>";
}
}

// Thumbnail Listing

else if( $cid && empty( $pid ) )
{
$number_of_thumbs_in_row = 3;

$result = mysql_query( "SELECT photo_id,photo_caption,photo_filename FROM gallery_photos WHERE photo_category='".addslashes($cid)."'" );
$nr = mysql_num_rows( $result );

if( empty( $nr ) )
{
$result_final = "\t<tr><td>No Category found</td></tr>\n";
}
else
{
while( $row = mysql_fetch_array( $result ) )
{
$result_array[] = "<a href=".$images_dir.'/'.$row[0].'.jpg'." class=\"thickbox\"><img src=".$images_dir.'/tb_'.$row[0].'.jpg'." border=\"0\" /></a><br />".$row[1]."<p>&nbsp;</p>";
}
mysql_free_result( $result );

$result_final = "<tr>\n";

foreach($result_array as $thumbnail_link)
{
if($counter == $number_of_thumbs_in_row)
{
$counter = 1;
$result_final .= "\n</tr>\n<tr>\n";
}
else
$counter++;

$result_final .= "\t<td>".$thumbnail_link."</td>\n";
}

if($counter)
{
if($number_of_photos_in_row-$counter)
$result_final .= "\t<td colspan='".($number_of_photos_in_row-$counter)."'>&nbsp;</td>\n";

$result_final .= "</tr>";
}
}
}

// Final Output
echo <<<__HTML_END
<p>&nbsp;</p>
<center>
<table id='phototable'>
$result_final
</table>
<p>&nbsp;</p>
<a href="#" onclick="window.scrollTo(0,0); return false">Back to Top</a>
<p>&nbsp;</p>
</center>
__HTML_END;
?>
</div>
</div>
<div id="footer">
<div id="footercontent">
<br />&copy;2010 Katies Kakes. All Rights Reserved
<br />Website Designed by Ben Jarvis Web Design
</div>
</div>
</div>
</div>
<!-- GoStats JavaScript Based Code -->
<script type="text/javascript" src="http://gostats.com/js/counter.js"></script>
<script type="text/javascript">_gos='c5.gostats.com';_goa=1008492;
_got=5;_goi=1;_gol='web site traffic analysis';_GoStatsRun();</script>
<noscript><a target="_blank" title="web site traffic analysis"
href="http://gostats.com"><img alt="web site traffic analysis"
src="http://c5.gostats.com/bin/count/a_1008492/t_5/i_1/counter.png"
style="border-width:0" /></a></noscript>
<!-- End GoStats JavaScript Based Code -->
</body>
</html>

Makes a little sense to me but still dont understand how this links with the other pages. I appreciate your help.
Feb 10 '11 #7
nathj
938 Expert 512MB
Hi,

Reading through the PHP section of the code I can see that you have 2 table:
  • gallery_photos
  • photo_catgeory
I would suggest that to add either a new category or a new photo to an existing category you need to add row(s) to these tables.

Do you have a local non-live version of the site you trial with? Having a localhost version would enable you to play around with the site and the data contents without affecting the live site.

I hope that helps.
nathj

PS Please remember to use code tags next time - it makes your code much easier to read and provides line numbers so I can give reference to specific points in the code sample.
Feb 11 '11 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Shawn McNiven | last post by:
Hello, I have a problem with an application i'm working on (Asp.net using vb.net for developing). I'm normally used to doing middle tier development, so my javascript skills are not up to par. ...
3
by: Magnuski | last post by:
Does anyone know how to design an interface for a non technical web administrator so that they can edit their website's content wiithout resorting to hand coding or having to see the code at all,I...
1
by: js | last post by:
Does anyone know how to create a web project with Visual Studio.Net 2003 on IIS6 running on Windows Server 2003? The IIS has the default website disabled, and a new website is created. I have...
1
by: JP.Gantlin | last post by:
I don't have the tool! What can I do? as mentioned in the web.config file: Note: As an alternative to hand editing this file you can use the web admin tool to configure settings for your...
6
by: maghi85 | last post by:
hi, i wanted to know how i can append something or add or remove something from a LOG file on my website... from my website itself i'm using Visual Web Developer 2005 letsay you click on a button...
1
by: sowmram | last post by:
Hi, I'm trying to create a site very similar to wiki, where you can edit, save.. Generally update data for the future use... This particular program I wanna do it using javascripts... Please...
2
by: sowmram | last post by:
Hi, I'm trying to create a site very similar to wiki, where you can edit, save.. Generally update data for the future use... This particular program I wanna do it using javascripts... Please...
3
by: honeys | last post by:
Hi , I am doing a website that shows one word document to everyone. If the users open that and would like to edit the information they can edit.But when they go to save button and saves it, it...
0
by: yUSiyE | last post by:
I have a CSS of my website need some editing. If any of you interested, please contact, it's a paying job(of course) task is quite simple, I have only one css need editing. all the layout of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.