shopping cart codings

Coding Critique is the place to post source code for peer review by other members of DevNetwork. Any kind of code can be posted. Code posted does not have to be limited to PHP. All members are invited to contribute constructive criticism with the goal of improving the code. Posted code should include some background information about it and what areas you specifically would like help with.

Popular code excerpts may be moved to "Code Snippets" by the moderators.

Moderator: General Moderators

Post Reply
karthikam
Forum Newbie
Posts: 2
Joined: Tue Apr 21, 2009 9:12 am

shopping cart codings

Post by karthikam »

i have attached screenshot and template.php file is pasted at the end of this page

web root:/plaincart/
server root:/root/www/plaincart/

the following code occurs in the file:


<title><?php echo $pageTitle; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="<?php echo WEB_ROOT;?>admin/include/admin.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/javascript" src="<?php echo WEB_ROOT;?>library/common.js"></script>
<?php
$n = count($script);
for ($i = 0; $i < $n; $i++) {
if ($script[$i] != '') {
echo '<script language="JavaScript" type="text/javascript" src="' . WEB_ROOT. 'admin/library/' . $script[$i]. '"></script>';
}
}
?>

questions:

what is the use of <link href> tag here
what is the result of <?php echo WEB_ROOT;?>
whether we are including javascript file to this file
what is $script here
explain completely the following code and why its uses here.

for ($i = 0; $i < $n; $i++) {
if ($script[$i] != '') {
echo '<script language="JavaScript" type="text/javascript" src="' . WEB_ROOT. 'admin/library/' . $script[$i]. '"></script>';
}
}


template.php

<?php
if (!defined('WEB_ROOT')) {
exit;
}

$self = WEB_ROOT . 'admin/index.php';
?>
<html>
<head>
<title><?php echo $pageTitle; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="<?php echo WEB_ROOT;?>admin/include/admin.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/javascript" src="<?php echo WEB_ROOT;?>library/common.js"></script>
<?php
$n = count($script);
for ($i = 0; $i < $n; $i++) {
if ($script[$i] != '') {
echo '<script language="JavaScript" type="text/javascript" src="' . WEB_ROOT. 'admin/library/' . $script[$i]. '"></script>';
}
}
?>
</head>
<body>
<table width="750" border="0" align="center" cellpadding="0" cellspacing="1" class="graybox">
<tr>
<td colspan="2"><img src="<?php echo WEB_ROOT; ?>admin/include/banner-top.gif" width="750" height="75"></td>
</tr>
<tr>
<td width="150" valign="top" class="navArea"><p>&nbsp;</p>
<a href="<?php echo WEB_ROOT; ?>admin/" class="leftnav">Home</a>
<a href="<?php echo WEB_ROOT; ?>admin/category/" class="leftnav">Category</a>
<a href="<?php echo WEB_ROOT; ?>admin/product/" class="leftnav">Product</a>
<a href="<?php echo WEB_ROOT; ?>admin/order/?status=Paid" class="leftnav">Order</a>
<a href="<?php echo WEB_ROOT; ?>admin/config/" class="leftnav">Shop Config</a>
<a href="<?php echo WEB_ROOT; ?>admin/user/" class="leftnav">User</a>
<a href="<?php echo $self; ?>?logout" class="leftnav">Logout</a>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p></td>
<td width="600" valign="top" class="contentArea"><table width="100%" border="0" cellspacing="0" cellpadding="20">
<tr>
<td>
<?php
require_once $content;
?>
</td>
</tr>
</table></td>
</tr>
</table>
<p>&nbsp;</p>
<p align="center">Copyright &copy; 2005 - <?php echo date('Y'); ?> <a href="http://www.phpwebcommerce.com"> http://www.phpwebcommerce.com</a></p>
</body>
</html>


I am not able to attach the screenshot file(paint file) to this .What would be the problem?
Last edited by karthikam on Fri Apr 24, 2009 6:59 am, edited 6 times in total.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: error in shopping cart codings for display category pictures

Post by Christopher »

You would need to make the effort to tell us where you think the error is and show the code section where you think the problem occurs.
(#10850)
BalajiM
Forum Newbie
Posts: 1
Joined: Wed Apr 22, 2009 11:09 am

Re: error in shopping cart codings for display category pictures

Post by BalajiM »

You have to make sincere attempt, to look into the code and try to figure out what exactly the problem is. Did you go through the FAQ's mentioned in the website.

More over it is difficult and would require lot of effort and time for the members get all the files, setup the environment and find the reasons for your problem.

Keep in mind, yours can be a configuration issue at your end as well. May work for others.

Pinpoint the problem causing area trough the code snippet and also the screenshots if possible. Share the problem files along with their dependencies,

Last but not least, you have to be humble & nice while requesting for the help/guidance.Your posting sounds as though you are seeking support for the serivce you have already paid.
Post Reply