Creating valid but dynamic layouts in PHP
Posted: October 19th, 2011 | Author: Jess | Filed under: PHP, Web Development | No Comments »When creating a dynamic layout in PHP how do you go about creating unique divs if they are being used on a repetitive scale for example galleries portfolios.
I was thinking I could have the following:
but by using this it of course altered my divs with a number therefore screwed up my css. What would you do? Hello, I am having another issue with the below code: $target = "/dir/includes/images/Gallery/"; $target = move_uploaded_file($_FILES ['ImagePath']['tmp_name'], $_SERVER['DOCUMENT_ROOT']. "$target"); When I try and upload I get the following warning; Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move ‘/tmp/php1O7Yzh’ to ‘/home/user/public_html/dir/includes/images/Gallery/’ in /home/user/public_html/dir/Admin/includes/class/class.image.php on line 94 I have set the Gallery privileges to 757 and still no luck. What could I try? Update Thanks to Sheldon Lendrum, I was told that $target did not have a name, I needed to add . $_FILES['ImagePath']['name'] onto $target Hey Guys, Could someone please tell me why my regex is not working in the below code for some reason it likes alpha characters as well. // Check Phone Number var bValid = false; if((sVF.length > 0) && (phoneobj.test(sVF))) { id(sFieldID +"Error").innerHTML ="Valid"; } else { id(sFieldID +"Error").innerHTML ="Not Valid"; } return bValid; } Thanks For all of my websites I use the following PHP process script. What I would like to know is how other PHP coders would alter or change it to protect it from spammers and xss attacks. Is PHP Mailer any good? Below is the process code of a form that lets you select the subject. I have got the following code: What I would like to do is enable it so when the space bar is pressed – the slideshow stops. When is is pressed again the slideshow resumes. I have googled and have not come across anything like what I am looking for. $(document).ready(function() { Today I was away from my course due to expecting some course text books and with all of this rain at the moment I did not want them getting wet. So knowing that they were sent on Thursday afternoon I e-mail the company this morning asking for the track and trace number so I could find out when my package will be arriving. At about 4PM I placed a tweet over Twitter because I was a bit let down by the service a few minutes later I get a reply. This has got me thinking due to I have had also quicker responses from other big names businesses via Twitter and from my point of view I find it quicker to get answers from them via Twitter then ring and be placed on hold listening to the Natures Best CD for a hour. Is social media the new way of getting answers? Today, We learnt about slicing a website ready for html coding. The tutor proceeded to tell us that it was best to save graphics in .JPG but the thing is I cannot remember the last time I used a .JPG file in a website. As a Developer what file format do you use?
During my first two days of learning I have come to a very serious issue when it comes to learning about website usability it seems that disability usability gets interlinked with general website usability. I have thought to myself that this cannot be correct. I proceeded to send an e-mail to Nic Steenhout from Accessibility NZ stating: Should disability usability come under its own section away from general usability? Nic’s response was very informative and along the same lines that I have been thinking over the past couple of days. “This is, I think, one of the most important issues of accessibility/usability. A lot of people believe that if they know usability, they know accessibility. And it’s not the case at all. “Disability accessibility” is a topic all of its own, it does not come under “general usability”. Note, we talk about disability accessibility, not disability usability.” Nic also goes onto say “I think it’s a bloody shame that schools/university teaching web development barely touch on usability and rarely discuss accessibility. Particularly in view of legal requirements for websites needing to be accessible.” Now after all of this I now have another question: Why is there no teaching about disability usability when it comes to learning/studying about web development and should this be included within the usability guidelines? Today was my first day beginning a Diploma of Web Development at Natcoll and the first section that we are covering is about website usability and the methods that are out there. The question that I have been pondering over today is that even through we think that “usability” is common knowledge. Do you as a Web Developer use any of these Methods in your day to day working environment?. Please feel free to leave a comment or to vote in the poll. I have been working on a website that has required me to create new shipping methods. The steps below will enable you to create ether new payment or shipping modules. Yourmodule = Module Name Step One: Your OSC Dir /includes/modules/shipping or payment dictionary/item.php. and Your OSC Dir /public_html/includes/languages/english/modules/shipping or payment dictionary/item.php. Step Two Open up the modules item.php file and re save it as yourmodule.php. Step Three Make the following changes: Step Four Open up the languages item.php file and re save it as yourmodule.php. Step Five Make the following changes: Step Five Install the modules via OSC Admin
PHP Move_Upload Error
Posted: January 20th, 2011 | Author: Jess | Filed under: PHP | Tags: error, function, move_uploaded_file, PHP, privileges | No Comments »
Javascript Regex Not Working
Posted: January 20th, 2011 | Author: Jess | Filed under: Javascript, Web Development | Tags: error, Javascript, validation | No Comments »
function CheckPhone(sFieldID) {
var sVF = id(sFieldID).value; // gets the fields value
var phoneobj = new RegExp("^[0-9]$"); //Checks the Phone is valid
id(sFieldID +"Error").innerHTML ="Not Valid";
bValid = true;
PHP Contact Form
Posted: October 30th, 2010 | Author: Jess | Filed under: PHP, Web Development | Tags: Contact, Form, Mailer, PHP, Process, Spammers, SSX | No Comments »
<?php
session_start();
if (!empty($_POST['validation']) && strlen($_POST['validation'])==10){
$required_fields = array('name', 'email', 'phone', 'subject', 'message');
foreach($_POST as $key => $value) {
$_SESSION[$key] = trim($value);
if(in_array($key, $required_fields) && empty($value)) $errors[] = ucwords($key) .' is required!';
}
if(!$errors) {
$subject = $_SESSION['subject'];
$message = $_SESSION['subject'] ."\n\n";
$message .= "Name: ". $_SESSION['name'] ."\n";
$message .= "E-Mail: ". $_SESSION['email'] ."\n\n";
$message .= "Phone: ". $_SESSION['phone'] ."\n";
$message .= "Message: ". wordwrap ($_SESSION['message']);
$message .= "\n\n";
$message .= date('j/m/Y g:ia');
$headers = "From:" . $_SESSION['name'] ." <". $_SESSION['email'] .">\n";
$headers .= "Reply-To: ". $_SESSION['name'] ." <". $_SESSION['email'] .">\n";
$headers .= "Return-Path: ". $_SESSION['name'] ." <". $_SESSION['email'] .">\n";
$headers .= "Bcc:\n";
if(mail($to, $subject, $message,$headers)){
$status = "Thank You, Your enquiry has been sent.";
}else{
$status = "ERROR! There was a system error, Please send your enquiry again.";
}
}else{
$status = implode('<br />', $errors );
}
}
$_SESSION['error'] = $status;
header("Location: ../contact.php");
die();
?>
Jquery.Cycle Help
Posted: August 20th, 2010 | Author: Jess | Filed under: Jquery | Tags: cycle, help, Jquery | 1 Comment »
$(‘.slideshow’).cycle({
fx: ‘fade’ // choose your transition type, ex: fade, scrollUp, shuffle, etc…
});
});
Are We Now Getting Quicker Response’s From Businesses
Posted: August 9th, 2010 | Author: Jess | Filed under: Social Media | Tags: Business, Contact, Facebook, Telecom, Twitter, Vodafone | No Comments »
Loading ...
Images and Web
Posted: July 23rd, 2010 | Author: Jess | Filed under: Graphics, Web Development | Tags: .gif, .jpg, .png, Formats, Images, Slicing, Web Development | 2 Comments »
Loading ...
General Website Usability Vs Disability Usability
Posted: July 14th, 2010 | Author: Jess | Filed under: Usability, Web Development | Tags: Disability, Guidelines, Planning, Usability, Web Development | 2 Comments »
Website Usability
Posted: July 13th, 2010 | Author: Jess | Filed under: Usability, Web Development | Tags: Clients, Interface, Methods, Planning, Usability, User, Web Development, Website | 1 Comment »
Loading ...
Adding Modules In Oscommerce
Posted: August 12th, 2009 | Author: Jess | Filed under: Web Development | Tags: Adding, Module, Modules, OSC, Oscommerce | No Comments »
Make a back up copy of the following files:/*
$Id: yourmodule.php 1739 2007-12-20 00:52:16Z hpdl $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
Released under the GNU General Public License
*/
class yourmodule {
var $code, $title, $description, $icon, $enabled;
// class constructor
function yourmodule() {
global $order;
$this->code = 'yourmodule';
$this->title = MODULE_SHIPPING_YOURMODULE_TEXT_TITLE;
$this->description = MODULE_SHIPPING_YOURMODULE_TEXT_DESCRIPTION;
$this->sort_order = MODULE_SHIPPING_YOURMODULE_SORT_ORDER;
$this->icon = '';
$this->tax_class = MODULE_SHIPPING_YOURMODULE_TAX_CLASS;
$this->enabled = ((MODULE_SHIPPING_YOURMODULE_STATUS == 'True') ? true : false);
if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_YOURMODULE_ZONE > 0) ) {
$check_flag = false;
$check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_YOURMODULE_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
while ($check = tep_db_fetch_array($check_query)) {
if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->delivery['zone_id']) {
$check_flag = true;
break;
}
}
if ($check_flag == false) {
$this->enabled = false;
}
}
}
// class methods
function quote($method = '') {
global $order, $total_count;
$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_YOURMODULE_TEXT_TITLE,
'methods' => array(array('id' => $this->code,
'title' => MODULE_SHIPPING_YOURMODULE_TEXT_WAY,
'cost' => (MODULE_SHIPPING_YOURMODULE_COST * $total_count) + MODULE_SHIPPING_YOURMODULE_HANDLING)));
if ($this->tax_class > 0) {
$this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
}
if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title);
return $this->quotes;
}
function check() {
if (!isset($this->_check)) {
$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_YOURMODULE_STATUS'");
$this->_check = tep_db_num_rows($check_query);
}
return $this->_check;
}
function install() {
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable fifteen Shipping', 'MODULE_SHIPPING_YOURMODULE_STATUS', 'True', 'Do you want to offer per fifteen rate shipping?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Shipping Cost', 'MODULE_SHIPPING_YOURMODULE_COST', '2.50', 'The shipping cost will be multiplied by the number of items in an order that uses this shipping method.', '6', '0', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Handling Fee', 'MODULE_SHIPPING_YOURMODULE_HANDLING', '0', 'Handling fee for this shipping method.', '6', '0', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_YOURMODULE_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Shipping Zone', 'MODULE_SHIPPING_YOURMODULE_ZONE', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_YOURMODULE_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
}
function remove() {
tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
function keys() {
return array('MODULE_SHIPPING_YOURMODULE_STATUS', 'MODULE_SHIPPING_YOURMODULE_COST', 'MODULE_SHIPPING_YOURMODULE_HANDLING', 'MODULE_SHIPPING_YOURMODULE_TAX_CLASS', 'MODULE_SHIPPING_YOURMODULE_ZONE', 'MODULE_SHIPPING_YOURMODULE_SORT_ORDER');
}
}
<?php
/*
$Id: yourmodule.php 1739 2007-12-20 00:52:16Z hpdl $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2002 osCommerce
Released under the GNU General Public License
*/
define('MODULE_SHIPPING_YOURMODULE_TEXT_TITLE', 'Module Text');
define('MODULE_SHIPPING_YOURMODULE_TEXT_DESCRIPTION', 'ModuleText');
define('MODULE_SHIPPING_YOURMODULE_TEXT_WAY', 'Module Text');
?>