Jump to content

edawg

Members
  • Posts

    34
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

edawg's Achievements

Member

Member (2/5)

0

Reputation

  1. Dont know if this will help any, but here is the function that displays the categories. function renderCustomCategories(){ $out = ''; if (sizeOf($this->categories) > 0) { $out .= '<h3>Popular categories</h3>'; $out .= '<ul>'; foreach ($this->categories as $category) { $out .= '<li>'.$this->customCategoryLink($category).'</li>'; } $out .= '</ul>'; } return $out; }
  2. Thanks! BaseURL function. function baseURL($paramNamesToStrip) { $url = $this->requestURI(); foreach ($_REQUEST as $key => $value) { foreach ($paramNamesToStrip as $paramName) { $url = $this->stripParameter($url,$paramName,$key,$value); } } return $url; } AddParameter Function. function addParameter($url,$paramName,$paramValue) { if (strlen($paramValue) > 0) { $delimiter = (strpos($url,'?') > -1) ? '&' : '?'; $url = $url.$delimiter.$this->nameSpace.$paramName.'='.urlencode($paramValue); } return $url; }
  3. I use Popshops Datafeed API and cant figure out an issue im having with an array. I'm trying to retrieve a category name from an array for the current page. Here is the array code which is in the index.php file. $categories = array(); $categories[] = array( 'name' => 'page name', 'search_options' => array( 'keywords' => 'page keyword' ) ); $categories[] = array( 'name' => 'page name', 'search_options' => array( 'keywords' => 'page keyword' ) ); $categories[] = array( 'name' => 'page name', 'search_options' => array( 'keywords' => 'page keyword' ) ); This is how the script calls the current page keyword. <?php echo ucwords($_REQUEST[$popshops->nameSpace.'keywords']) ?> The code above works fine, so I thought all I had to do was change the 'keywords' to 'name' to get what I was looking for. But that does not seem to work? <?php echo ucwords($_REQUEST[$popshops->nameSpace.'name']) ?> I've tried as much as my limited php knowledge can take me, so now I need some advice. Here is the function in the popshops.php file they use to pull the page name out for the links in the navigation, but I just want to know how to retrieve just the category name for the current page, nothing else. function customCategoryLink($category) { $url = $this->baseURL($this->params); if (isset($category['search_options']) && sizeOf($category['search_options']) > 0) { foreach($category['search_options'] as $key => $value) { $url = $this->addParameter($url,$key,$value); } } else { $url = $this->addParameter($url,'keywords',$category['name']); } $url = str_replace('?&','?',$url); return '<a href="'.$url.'">'.$category['name'].'</a>'; } Thanks in advanced!
  4. WILDBUG YOU ARE THE MAN!!!!!!!!!!!!!!!!!!!!. thanks a million mate!.
  5. hi, how can I clear rows from a table field?. I have a table set up, and what I want to do is count some votes, but once a week I want to clear all the votes to have them return to zero, so that way I can count fresh results for the new week?.
  6. Ive seen tutorials on this subjet, but just cant get them to work on my site?.
  7. I have a limit line there tho?.
  8. Im trying to paginate some db results, the problem is, I have categories of pictures with 56 pics in total, now when I try to paginate these results in there own category, rather than get the category pics only to display over a few pages, I get the entire picture db displayed instead. What happens is when I click category "Animals", instead of the 11 pics in that table, I get 6 pics, which is fine as its my Max_Results_Per_Page, but the next page links at the bottom will display all the pictures in the db rather than the ones i need. $display = 6; // rows of results per page if (isset($_GET['np'])) { // if num of pages isset then assign the VAR $num_pages = $_GET['np']; // here its assigned from above. } // Determine where in the database to start returnind results. if (isset($_GET['s'])) { $start = $_GET['s']; } else { $start = 0; } // Get the users input choice $varCategory = $_GET['cpCategory']; $signs = array("-", "_"); $varCriteria = str_replace($signs, " ", safe_output($_GET['txtSearch'])); // Make the QUERY`s mysql_select_db($database, $connDB); $query_rsResults = "SELECT site_categories.sc_id, site_categories.sc_title, site_categories.sc_keywords, site_categories.sc_description, site_categories.sc_url, site_pictures.sp_id, site_pictures.sc_id, site_pictures.sp_title, site_pictures.sp_description, site_pictures.sp_location, site_pictures.sp_filename_TN, site_pictures.sp_filename, site_pictures.sp_sender, site_pictures.sp_votes FROM site_categories, site_pictures WHERE site_categories.sc_id = site_pictures.sc_id"; // IF Category Search if ($varCategory!="") { $query_rsResults.= " AND (site_categories.sc_url = '$varCategory')"; } // IF Critera Search if ($varCriteria!="") { $query_rsResults.= " AND (site_pictures.sp_description LIKE '%" . $varCriteria . "%' OR site_pictures.sp_title LIKE '%" . $varCriteria . "%' OR site_pictures.sp_ALT LIKE '%" . $varCriteria . "%' OR site_pictures.sp_location LIKE '%" . $varCriteria . "%' OR site_pictures.sp_category LIKE '%" . $varCriteria . "%' OR site_pictures.sp_filename LIKE '%" . $varCriteria . "%' OR site_pictures.sp_filename_TN LIKE '%" . $varCriteria . "%')"; } $query_limit_rsResults = sprintf("%s LIMIT %d, %d", $query_rsResults, $start, $display); $rsResults = mysql_query($query_limit_rsResults, $connDB) or die (mysql_error()); // run the above query $row_rsResults = mysql_fetch_assoc($rsResults); // fetch back as an array of results. $num = mysql_num_rows($rsResults); if ($num > $display) { // more than one page $num_pages = ceil($num_pag/$display); } else { $num_pages = 1; } What am I doing wrong???.
  9. Is it possilbe to update more than one table at a time using the same UPDATE command???, or do I have to use 2 seperate UPDATE queries?.
  10. Hello, Ive been using cakephp for 2 days now, and am having problems with tutorials, the manual is ok, but is there another really good tutorial to get me started the right way??. What are your views on cakePHP, should I bother with it???, is there anything else, apart from ruby?. Thanks
  11. Hi All! If my site is using cookies and sessions for the logged in users, should I also use them for any users that do not sign up, or log-in?, ive noticed php freaks uses guest if you are not a member, is this common practice?, is it more secure?. Thanks to anyone that replies...
  12. So you would setcookie() and start session with the same user info variables when they log-in??. And for any regular un-registered user, is it a good idea to set them a cookie or session too??.
  13. Hi, What I want to do is make a website im working on more user friendly, so ive completed the registration and login side to the site, but i need advice on what to use from here?, im using sessions at the moment while the user is logged in, but some people say there not to secure?, then I see things about HTTP authorization?, and also cookies?, im confused........ My question is, what is the most secure and reliable thing to use as users login, and go about the website?, what do most of you use?. Thanks for all your help!.
  14. thanks for all your help, will work on it over the next few days!!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.