
spires
Members-
Posts
492 -
Joined
-
Last visited
Everything posted by spires
-
OK, I have a work around, but i'm sure the other way should work fine. So, if you have another / better way to do it, please let me know. Work Around $expKey = explode("<br />", nl2br($_POST['key_'.$i]));
-
Hi I'm trying to separate each line of a text filed and place each line in to an array one by one. At the moment i'm just trying get echo out the count of how many items a are in the array $expKey; When entering the words in the text field, i'm pressing return to move doen to the next line. I'm adding 4 lines of text. So, the count should be 4. Or am I missing something? $expKey = explode("/n", $_POST['keywords']); echo count($expKey). ' '; Thanks
-
ok, I see. URL should beL feed://businessgrowthinternational.co.uk/rss.xml Adding Feed at the start. However, in Chrome this does not work? Any ideas?
-
Hi, I have created a RSS Feed on my website. But for some reason, when I go to the URL, it just displays the contents of the rss on the screen, rather that taking the user to the actual RSS feed, where they can join? URL: http://businessgrowthinternational.co.uk/rss.xml <?PHP require_once('includes/initialize.php'); $lastBlog = Blog::find_last_posted(); $blogDateMod = $lastBlog->dateMod; echo ' <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <channel> <atom:link href="http://www.businessgrowthinternational.co.uk/rss.xml" rel="self" type="application/rss+xml" /> <title>Business Growth Internation</title> <link>'.SITE_DOMAIN.DS.'blog_list</link> <description>Learn the of Business & Personal Success. Business Growth Internation will give you all the tools you need to succeed. Join now and start receiving your FREE Tips.</description> <language>en-us</language>'; $blogCat = Blog::find_all_order_by('position', 'ASC'); foreach($blogCat as $blogCats){ $ID = $blogCats->id; $title = ucwords($blogCats->title); $sub_title = ucwords($blogCats->sub_title); $blogDateMod = $blogCats->dateMod; $blogTimeMod = $blogCats->timeMod; $rss_date = date("r", strtotime($blogDateMod)); echo ' <item> <title>'.$title.'</title> <link>'.make_blog_url('tips', $ID, $title).'</link> <description>'.$sub_title.'</description> <pubDate>'.$rss_date.'</pubDate> </item>'; } echo ' </channel> </rss>'; ?>
-
Hi, Thanks for your help. I've not come across that before. I'm trying: if (in_array($LCname, array("Business_solutions_cat"))) { // for security $newChild = call_user_func($LCname . "::find_by_id", 1); foreach($newChild as $newChilds){ echo $newChilds->id; } } but nothing is echoing. Am I missing some code? Thanks
-
Hi How do I turn this: if($LCname=='Business_solutions'){ $newChild = Business_solutions::find_by_id(1); } In to something like this: $newChild = $LCname::find_by_id(1); I'm calling lots of class's, and want to make it more dynamic. The 2nd example would be perfect, but that does not work. Is there an alternative? Thanks
-
Thanks. I always miss that.
-
Hi I have a text area, that I want to display info pulled from a database. I can get the data to show, But can get each entry of the table to display on it's own line. Example: ob1ob2ob3ob4ob5 Should be: ob1 ob2 ob3 ob4 ob5 CODE: <textarea id="interest" onfocus="clearInterest()" class="textareacss" style="height:212px;overflow:auto;"><?PHP $newInterestSub = Admin_interests_sub::find_by_cat_id($id); foreach($newInterestSub as $newInterestSubs){ echo $newInterestSubs->interest_sub.'\n'; } ?></textarea> Any help would be great.
-
Found it BEFORE $interest = new Admin_interests_sub(); $interest->id = (int)$ID; $interest->category_id = (int)$category_id; $interest->interest_sub = $interest_sub; $kw->dateMod = $DMOD; $kw->timeMod = $TMOD; AFTER public static function make($ID, $category_id, $interest_sub, $DMOD, $TMOD){ if(!empty($interest_sub)){ $kw = new Admin_interests_sub(); $kw->id = (int)$ID; $kw->category_id = (int)$category_id; $kw->interest_sub = $interest_sub; $kw->dateMod = $DMOD; $kw->timeMod = $TMOD; return $kw; }else{ return false; } } Thanks Anyway
-
Hi I have a file, that is copied from other files. All other files work perfectly. But, for some reason this one is throwing back an error. I've been over it so many time, but can't see whats wrong. Error: Fatal error: Call to undefined method stdClass::save() in /home/p/o/powtest/web/public_html/admin/lib/ajax_php/add_interests.php on line 28 add_interests.php <?PHP require_once("../../../includes/initialize.php"); $flag = 0; $ID = $_POST['ID']; $type = $_POST['type']; $category = $_POST['category']; $interest = $_POST['interest']; $expInt = explode("\n", $interest); $DMOD = date('Y-m-d'); $TMOD = date('H:i:s'); $check_entry = Admin_interest::if_exists(clean_input_value($category)); if($check_entry == 0){ $new_category = Admin_interest::make($ID, clean_input_value($category), clean_input_value($type), $DMOD, $TMOD); if($new_category && $new_category->save()){ $CID = $new_category->id; $flag = 1; } } foreach($expInt as $expInts){ $check_entry = Admin_interests_sub::if_exists($CID, clean_input_value($expInts)); if($check_entry == 0){ $new_interest = Admin_interests_sub::make($ID, $CID, clean_input_value($expInts), $DMOD, $TMOD); if($new_interest && $new_interest->save()){ $message = 'Thank You: Your list Has Been Saved'; }else{ $message = "Sorry, There was an error"; } } } echo $message; ?> Class: <?PHP require_once(LIB_PATH.DS.'database.php'); class Admin_interests_sub { protected static $table_name="admin_interests_sub"; protected static $db_fields = array('id', 'category_id', 'interest_sub', 'dateMod', 'timeMod'); public $id; public $category_id; public $interest_sub; public $dateMod; public $timeMod; public static function make($ID, $category_id, $interest_sub, $DMOD, $TMOD){ if(!empty($interest_sub)){ $interest = new Admin_interests_sub(); $interest->id = (int)$ID; $interest->category_id = (int)$category_id; $interest->interest_sub = $interest_sub; $kw->dateMod = $DMOD; $kw->timeMod = $TMOD; return $kw; }else{ return false; } } protected function attributes(){ $attributes = array(); foreach(self::$db_fields as $field){ if(property_exists($this, $field)){ $attributes[$field] = $this->$field; } } return $attributes; } protected function sanitized_attributes(){ global $database; $clean_attributes = array(); foreach($this->attributes() as $key => $value){ $clean_attributes[$key] = $database->escape_value($value); } return $clean_attributes; } public function save(){ return !empty($this->id) ? $this->update() : $this->create(); } public function create(){ global $database; $attributes = $this->sanitized_attributes(); $sql = "INSERT INTO ".self::$table_name." ("; $sql .= join(", ", array_keys($attributes)); $sql .= ") VALUES ('"; $sql .= join("', '", array_values($attributes)); $sql .= "')"; if($database->query($sql)){ $this->id = $database->insert_id(); return true; }else{ return false; } } public function update(){ global $database; $attributes = $this->sanitized_attributes(); $attribute_pairs = array(); foreach($attributes as $key => $value){ $attribute_pairs[] = "{$key}='{$value}'"; } $sql = "UPDATE ".self::$table_name." SET "; $sql .= join(", ", $attribute_pairs); $sql .= " WHERE id=".$database->escape_value($this->id); $database->query($sql); return ($database->affected_rows() == 1) ? true : false; } public function delete(){ global $database; $sql = "DELETE FROM ".self::$table_name." "; $sql .= "WHERE id=".$database->escape_value($this->id); $sql .= " LIMIT 1"; $database->query($sql); return ($database->affected_rows() == 1) ? true : false; } } ?> Any help finding this bug will be a big help. Thanks
-
ok. I have now fixed the bug. But the page is not reading in the styles: http://test.powtest.co.uk/sitemap.xml Any ideas? Bug Fix: <?PHP require_once('includes/initialize.php'); $newAbout = Aboutme::find_by_id(1); $aboutDateMod = $newContact->dateMod; $newContact = Contact_details::find_by_id(1); $contactDateMod = $newContact->dateMod; $lastService = Services::find_last_posted(); $servicesDateMod = $lastService->dateMod; $lastBlog = Blog::find_last_posted(); $blogDateMod = $lastBlog->dateMod; echo '<?xml-stylesheet type="text/xsl" href="sitemap.xsl"?>'; Thanks
-
Hi. I'm trying to create my first XML sitemap that I am going to be submitting to google. The sitemap is going to be PHP but using MOD rewrite to make it look like an XML file. The site map has been created. http://test.powtest.co.uk/sitemap.xml But, I now want to style it. However, when I add the XML style file, I get an error: Parse error: syntax error, unexpected T_STRING in /home/a/d/adele/web/public_html/sitemap.php on line 1 I'm not to sure how to get my PHP file to read in the XML style file. Any help would be much appreciated PHP sitemap (sitemap.xml) <?xml-stylesheet type="text/xsl" href="sitemap.xsl"?> <?PHP require_once('includes/initialize.php'); $newAbout = Aboutme::find_by_id(1); $aboutDateMod = $newContact->dateMod; $newContact = Contact_details::find_by_id(1); $contactDateMod = $newContact->dateMod; $lastService = Services::find_last_posted(); $servicesDateMod = $lastService->dateMod; $lastBlog = Blog::find_last_posted(); $blogDateMod = $lastBlog->dateMod; // TOP NAVIGATION echo ' <url> <loc>'.SITE_DOMAIN.DS.'</loc> <lastmod>2011-01-17</lastmod> <changefreq>yearly</changefreq> <priority>0.8</priority> </url> <url> <loc>'.SITE_DOMAIN.DS.'services</loc> <lastmod>'.$servicesDateMod.'</lastmod> <changefreq>daily</changefreq> <priority>0.8</priority> </url> <url> <loc>'.SITE_DOMAIN.DS.'testimonials</loc> <lastmod>2011-01-17</lastmod> <changefreq>daily</changefreq> <priority>0.8</priority> </url> <url> <loc>'.SITE_DOMAIN.DS.'about_adele_fifer</loc> <lastmod>'.$aboutDateMod.'</lastmod> <changefreq>yearly</changefreq> <priority>0.8</priority> </url> <url> <loc>'.SITE_DOMAIN.DS.'contact</loc> <lastmod>'.$contactDateMod.'</lastmod> <changefreq>never</changefreq> <priority>0.8</priority> </url> <url> <loc>'.SITE_DOMAIN.DS.'tips</loc> <lastmod>'.$blogDateMod.'</lastmod> <changefreq>daily</changefreq> <priority>0.8</priority> </url>'; // SERVICE CAT $check = Services::count_CID(); if($check >= 1){ $serviceCat = Services_categories::find_all_order_by_exclude_nonFolder('category', 'ASC'); foreach($serviceCat as $serviceCats){ $ID = $serviceCats->id; $cat = ucwords($serviceCats->category); $servicesCatDateMod = $serviceCats->dateMod; if($checkCat = Services::if_CID_exists($ID)){ echo ' <url> <loc>'.make_cat_url('services_list', $ID, $cat).'</loc> <lastmod>'.$servicesCatDateMod.'</lastmod> <changefreq>daily</changefreq> <priority>0.8</priority> </url>'; } } } // SERVICE LIST $serviceCat = Services::find_all_order_by('title', 'ASC'); foreach($serviceCat as $serviceCats){ $ID = $serviceCats->id; $title = ucwords($serviceCats->title); $servicesDateMod = $serviceCats->dateMod; echo ' <url> <loc>'.make_url('services', $ID, $title).'</loc> <lastmod>'.$servicesDateMod.'</lastmod> <changefreq>yearly</changefreq> <priority>0.8</priority> </url>'; } // BLOG CAT $blogCat = Blog_categories::find_all_order_by('category', 'ASC'); foreach($blogCat as $blogCats){ $ID = $blogCats->id; $cat = ucwords($blogCats->category); $desc = $blogCats->smallDesc; $img = $blogCats->img; echo ' <url> <loc>'.make_cat_url('tips_list', $ID, $cat).'</loc> <lastmod>'.$servicesCatDateMod.'</lastmod> <changefreq>daily</changefreq> <priority>0.8</priority> </url>'; } // BLOG $blogCat = Blog::find_all_order_by('position', 'ASC'); foreach($blogCat as $blogCats){ $ID = $blogCats->id; $title = ucwords($blogCats->title); echo ' <url> <loc>'.make_url('tips', $ID, $title).'</loc> <lastmod>'.$servicesCatDateMod.'</lastmod> <changefreq>yearly</changefreq> <priority>0.8</priority> </url>'; } ?> XML Stylesheet (sitemap.xsl) <?xml version="1.0" encoding="UTF-8"?><!-- DWXMLSource="http://test.powtest.co.uk/sitemap.xml" --> <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> <!ENTITY copy "©"> <!ENTITY reg "®"> <!ENTITY trade "™"> <!ENTITY mdash "—"> <!ENTITY ldquo "“"> <!ENTITY rdquo "”"> <!ENTITY pound "£"> <!ENTITY yen "¥"> <!ENTITY euro "€"> ]> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" encoding="UTF-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/> <xsl:template match="/"> <html> − <head> − <title> Adele Fifer </title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> − <style type="text/css"> body { font-family: Arial, sans-serif; font-size:13px; } #intro { background-color:#CFEBF7; border:1px #2580B2 solid; padding:5px 13px 5px 13px; margin:10px; margin-top:40px; } #intro p { line-height: 16.8667px; } td { font-size:11px; } th { text-align:left; padding-right:30px; font-size:11px; } tr.high { background-color:whitesmoke; } #footer { padding:2px; margin:10px; font-size:8pt; color:gray; } #footer a { color:gray; } a { color:black; } #content { padding: 30px; } img, img a { border:none; } </style> </head> − <body> <h1>Adele Fifer Sitemap</h1> − <div id="content"> − <table cellpadding="5"> − <tr style="border-bottom: 1px solid black;"> <th>URL</th> <th>Priority</th> <th>Change Frequency</th> <th>LastChange</th> </tr> <xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/> <xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/> − <xsl:for-each select="sitemap:urlset/sitemap:url"> − <tr> − <xsl:if test="position() mod 2 != 1"> <xsl:attribute name="class">high</xsl:attribute> </xsl:if> − <td> − <xsl:variable name="itemURL"> <xsl:value-of select="sitemap:loc"/> </xsl:variable> − <a href="{$itemURL}"> <xsl:value-of select="sitemap:loc"/> </a> </td> − <td> <xsl:value-of select="concat(sitemap:priority*100,'%')"/> </td> − <td> <xsl:value-of select="concat(translate(substring(sitemap:changefreq, 1, 1),concat($lower, $upper),concat($upper, $lower)),substring(sitemap:changefreq, 2))"/> </td> − <td> <xsl:value-of select="concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)))"/> </td> </tr> </xsl:for-each> </table> </div> − <div id="footer"> <a href="http://test.powtest.co.uk/about_adele_fifer">About Adele Fifer</a> </div> </body> </html> </xsl:template> </xsl:stylesheet>
-
Hi I'm running some URL re writes on my website. But when I try to add a diectory in to the url, the page no longer displays any CSS or images. Is there any way around this? Example: No CSS http://test.powtest.co.uk/Services/5.html with CSS http://test.powtest.co.uk/services_list.php?cat=5 # Rewrite Services Cat RewriteRule ^Services/(.*[0-9]*)\.html$ /services_list.php?cat=$1 [L] Thanks
-
Server version: 5.0.51a-3ubuntu5.4
-
Yeah, I tried that first. Does not work either. Thanks, any other ideas?
-
Hi I can't seem to return the MAX position of my data in the MYSQL database. Class public static function find_last_pos(){ global $database; $sql = "SELECT max(position) as max_position FROM ".self::$table_name." LIMIT 1"; $result_array = self::find_by_sql($sql); return $result_array[0]->max_position; } HTML $POS = Blog_categories::find_last_pos(); echo $POS; Where am I going wrong? *note, the class works fine if I select * rather than max() Thanks
-
Yes: initialize.php: <?PHP defined('DS') ? null : define('DS', DIRECTORY_SEPARATOR); defined('SITE_ROOT') ? null : define('SITE_ROOT', $_SERVER['DOCUMENT_ROOT']); defined('LIB_PATH') ? null : define('LIB_PATH', SITE_ROOT.DS.'includes'); require_once(LIB_PATH.DS."config.php"); require_once(LIB_PATH.DS."functions.php"); // core objects require_once(LIB_PATH.DS."session.php"); require_once(LIB_PATH.DS."database.php"); require_once(LIB_PATH.DS."pagination.php"); require_once(LIB_PATH.DS."PHPMailer".DS."class.phpmailer.php"); require_once(LIB_PATH.DS."PHPMailer".DS."class.smtp.php"); // related classes require_once(LIB_PATH.DS."profile_user.php"); require_once(LIB_PATH.DS."blog.php"); require_once(LIB_PATH.DS."blog_img_signup.php"); require_once(LIB_PATH.DS."blog_categories.php"); ?> In HTML file require_once("../../../includes/initialize.php");
-
Yes. The folder 'includes' is 755 and all files in the inside the folder are 644 Anyother ideas?
-
They are 755 What should they be set to? Thanks
-
Hi I have this bit of code: defined('DS') ? null : define('DS', DIRECTORY_SEPARATOR); defined('SITE_ROOT') ? null : define('SITE_ROOT', $_SERVER['DOCUMENT_ROOT']); defined('LIB_PATH') ? null : define('LIB_PATH', SITE_ROOT.DS.'includes'); That i'm using so all systems can always find my class and important files. This works fine on on of my websites, but I have just moved it over to another website (exact setup & on same server) and it is not working!!! I'm getting the error: Warning: require_once(/includes/functions.php) [function.require-once]: failed to open stream: No such file or directory in /home/a/d/adele/web/public_html/includes/initialize.php on line 9 Fatal error: require_once() [function.require]: Failed opening required '/includes/functions.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/a/d/adele/web/public_html/includes/initialize.php on line 9 Basically, all my important files are in the initialize.php file. So I only need to call that one file on any of my html pages. I know it's DOCUMENT_ROOT, as when I remove this and link direct it works fine. Thanks for any help
-
Thanks I shall check it out.
-
Hi, I have a quick question: is it possible to replace a Class name with a variable? I keep getting an error when I try: Area_town::count_all(); becomes: $className = 'Area_town'; $className::count_all(); I want to make the page dynamic, but to do so, I have to have the Class name as a dynamic name. Error: Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in /home/p/o/powtest/web/public_html/admin/lib/pagination/paging_town_data.php on line 15 Thanks
-
Hi I have a list that is being pulled out of the database, and want to use AJAX to be able to delete any one of the rows. I have sucessfully achieved this, however, after deleting the row from the database, it does not show on the page untill after a page refresh? This defeats the point of wanting to use AJAX if I have to refresh the page. Any help with this will be much appreciated. HTML <?PHP foreach($list as $lists){ if($flag==1){ $class='class="even"'; }else{ $class='class="odd"'; } $ID = $lists->id; $country_id = $lists->country_id; $county_id = $lists->county_id; $town = ucwords($lists->town); echo ' <div '.$class.'> <div class="left1c">'.$town.'</div> <div class="left3"><a href="edit_area.php?id='.$ID.'"><img src="images/wrapper/edit2.png" width="18" height="16" alt="edit" /></a> <a href="#" onClick="delArea('.$ID.');return false;"><img src="images/wrapper/delete.png" width="15" height="16" alt="delete" /></a></div> <div class="clear"></div> </div>'; } ?> JAVASCRIPT function delArea(ID){ AJAXAdmin("lib/ajax_php/delete_area.php?id="+ID+""); } DELETE <?PHP require_once("../../../includes/initialize.php"); $ID = $_GET['id']; $setID = new Area_town(); $newID = $setID->id = $ID; if($setID && $setID->delete()){ $msg = "Success: The entry has been deleted."; }else{ $msg = "Sorry: There was an error please try again."; } echo $msg; ?> AJAX var xmlhttp = false; var internal_key; var rsval1; function AJAXAdmin( URL) { try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }catch(E){ xmlhttp = false; } } if ( !xmlhttp && typeof XMLHttpRequest!='undefined' ) { xmlhttp = new XMLHttpRequest(); } var now = new Date(); xmlhttp.open("GET", URL, true); xmlhttp.onreadystatechange = AjaxAdminDone; xmlhttp.send(null); } function AjaxAdminDone(){ try{ if(xmlhttp.readyState != 4) return; }catch(E){ return } try{ var strResp = xmlhttp.responseText.toString() ; document.getElementById('error').innerHTML = strResp; xmlhttp = null ; } catch(E){ alert(E.message + ' -- ' + strResp ); } } Thanks
-
Query need to be the other way around: $sql = "SELECT * FROM area_country INNER JOIN area_county "; $sql .= "ON area_country.id = area_county.country_id "; $sql .= "ORDER BY area_country.country, area_county.county ASC "; $sql .= "LIMIT {$per_page} "; $sql .= "OFFSET {$pagination->offset()}"; $list = Area_county::find_by_sql($sql);
-
Hi I want to know I can select which ID I get from an inner join? Not sure If I should post here or in the MYSQL forum, but as it's using OOP I posted here. $sql = "SELECT * FROM area_county INNER JOIN area_country "; $sql .= "ON area_county.country_id = area_country.id "; $sql .= "ORDER BY area_country.country, area_county.county ASC "; $sql .= "LIMIT {$per_page} "; $sql .= "OFFSET {$pagination->offset()}"; $list = Area_county::find_by_sql($sql); foreach($list as $lists){ $ID = $lists->id; $country_id = $lists->country_id; $county = ucwords($lists->county); $country = ucwords($lists->country); echo $ID; } I want it to show the ID of the county, NOT the id of the country. both tables in the database have the ID column called id. I know this can be done, but not to sure how. Thanks