Jump to content

madmega

Members
  • Posts

    20
  • Joined

  • Last visited

    Never

Everything posted by madmega

  1. IT WORKED, your script did the trick...thank you !!!
  2. Hi, i am trying to write a part of script for google shopping export, and all i want is that in this line, everything that is 0 or smaller, the line "pre-order" krijgt and everything that is 1 or greater the line "in stock" This is what i've got now, but it doesn't work I removed the rest of the long code. $patterns = array(); $patterns[0] = '=<0'; $patterns[1] = '=>1'; $replacements = array(); $replacements[0] = 'vooraf bestellen'; $replacements[1] = 'op voorraad'; if(OPTIONS_TONEN_FEED_AVAILABILITY == 1) $output .= "~" . preg_replace($patterns, $replacements, $row->quantity);
  3. Hi, i am editing a google_feeder script, normally, this script takes a column from a SQL database table but what i want is to take another column from another database table in the same SQL database.This is the script i am currently running <?php define('SEO_URLS_GEBRUIKEN','true'); define('BESTANDSNAAM', 'googleshopping_feed.txt'); define('WEBSITE_LINK', ''.$_SERVER['SERVER_NAME'].'/'); define('FTP_USERNAME', 'naam'); define('FTP_PASSWORD', 'password'); define('FTP_ENABLED', (isset($_GET['noftp']) ? '0' : '0')); define('CONVERT_CURRENCY', '0'); define('VALUTA', 'EUR'); define('TAAL_ID_LANGUAGE', 5); define('QUOTES_CATEGORY_NAME',''); define('OPTIONS_TONEN', 1); define('OPTIONS_TONEN_AGE_RANGE', 0); define('OPTIONS_TONEN_ATTRIBUTES', 1); define('OPTIONS_TONEN_BRAND', 1); define('OPTIONS_TONEN_CONDITION', 1); define('OPTIONS_TONEN_CURRENCY', 0); define('OPTIONS_TONEN_EXPIRATION', 1); define('OPTIONS_TONEN_FEED_LANGUAGE', 0); define('OPTIONS_TONEN_FEED_QUANTITY', 1); define('OPTIONS_TONEN_GTIN', 0); define('OPTIONS_TONEN_GOOGLE_UTM', 0); define('OPTIONS_TONEN_ISBN', 0); define('OPTIONS_TONEN_MADE_IN', 0); define('OPTIONS_TONEN_MANUFACTURERS_ID', 0); define('OPTIONS_TONEN_PAYMENT_ACCEPTED', 0); define('OPTIONS_TONEN_PRODUCT_MODEL', 1); define('OPTIONS_TONEN_PRODUCT_TYPE', 1); define('OPTIONS_TONEN_SHIPPING', 1); define('OPTIONS_TONEN_INCLUDE_TAX', 0); define('OPTIONS_TONEN_UPC', 0); define('OPTIONS_TONEN_WEIGHT', 1); define('OPTIONS_AGE_RANGE', '10-50 years'); define('OPTIONS_BRAND', 'Gadgets'); define('OPTIONS_CONDITION', 'Nieuw'); //possible entries are New, Refurbished, Used define('OPTIONS_DEFAULT_CURRENCY', 'EUR'); define('OPTIONS_DEFAULT_FEED_LANGUAGE', 'NL'); define('OPTIONS_DEFAULT_GOOGLE_UTM', '?utm_source=GoogleBase1&utm_medium=BaseFeed1&utm_campaign=products'); //see http://www.google.com/support/googleanalytics/bin/answer.py?hl=en&answer=55578 define('OPTIONS_GTIN', ''); define('OPTIONS_ISBN', ''); define('OPTIONS_MADE_IN', 'US'); define('OPTIONS_MANUFACTURERS_NAME', '1'); define('OPTIONS_PAYMENT_ACCEPTED_METHODS', ''); define('OPTIONS_PRODUCT_TYPE', 'full'); //define('OPTIONS_TAX_STRING', ''); //the following is for the shipping override option - enter multiple values separated by a comma //Format entries follow. A colon must be present for each field, whether it is entered or not. // COUNTRY - OPTIONAL - If country isn't included, we'll assume the shipping price applies to the target country of the item. If region isn't included, the shipping price will apply across the entire country. // REGION - OPTIONAL - blank for entire country, otherwise, us two-letter State (CA), full zip code (90210) or wildcard zip code (902*) // SERVICE - OPTIONAL - The service class or delivery speed, i.e. ground // PRICE - REQUIRED - Fixed shipping price (assumes the same currency as the price attribute) //define('OPTIONS_SHIPPING_STRING', 'nl::Ground:19.00'); //says charge tax to US for residents of Florida at 5% and don't apply tax to shipping //the following is for the tax override option - enter multiple values separated by a comma //Format entries follow. A colon must be present for each field, whether it is entered or not. // COUNTRY - OPTIONAL - country the tax applies to - only US for now // REGION - OPTIONAL - blank for entire country, otherwise, us two-letter State (CA), full zip code (90210) or wildcard zip code (902*) // TAX - REQUIRED - default = 0 (e.g. for 5.76% tax use 5.76) // SHIPPING - OPTIONAL - do you charge tax on shipping - choices are y or n //define('OPTIONS_TAX_STRING', 'NL::19.00:n'); //says charge tax to US for residents of Florida at 5% and don't apply tax to shipping define('OPTIONS_UPC', ''); define('OPTIONS_WEIGHT_ACCEPTED_METHODS', 'g'); //the following allow skipping certain items define('OPTIONS_IGNORE_PRODUCT_ZERO', 0); $taxRate = 19; // (Prijs tonen inclusief XX BTW. Prijzen worden EX BTW uit de dabase gehaald.) /***********************************************************************************************/ // Configuratie instellingen ophalen require_once('../includes/configure.php'); if (! function_exists("tep_not_null")) { function tep_not_null($value) { if (is_array($value)) { return ((sizeof($value) > 0) ? true : false); } else { return ((($value != '') && (strtolower($value) != 'null') && (strlen(trim($value)) > 0)) ? true : false); } } } if(SEO_URLS_GEBRUIKEN=='true'){ //******************** // Modification for SEO // Since the ultimate SEO was only installed on the public side, we will include our files from there. require_once('../includes/filenames.php'); require_once('../includes/database_tables.php'); include_once('../' .DIR_WS_CLASSES . 'seo.class.php'); $seo_urls = new SEO_URL(TAAL_ID_LANGUAGE); function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true) { global $seo_urls; return $seo_urls->href_link($page, $parameters, $connection, $add_session_id); } } // ----------- $stimer = explode( ' ', microtime() ); $stimer = $stimer[1] + $stimer[0]; // ----------- $OutFile = "../feeds/" . BESTANDSNAAM; $destination_file = BESTANDSNAAM; $source_file = $OutFile; $imageURL = 'http://' . WEBSITE_LINK . 'images/products_large/'; if(SEO_URLS_GEBRUIKEN=='true'){ $productURL = 'product_info.php'; // ***** Revised for SEO $productParam = "products_id="; // ***** Added for SEO }else{ $productURL = 'http://' . WEBSITE_LINK . '/product_info.php?products_id='; } $already_sent = array(); if(CONVERT_CURRENCY) { if(SEO_URLS_GEBRUIKEN=='true'){ $productParam="currency=" . VALUTA . "&products_id="; }else{ $productURL = "http://" . WEBSITE_LINK . "/product_info.php?currency=" . VALUTA . "&products_id="; //where VALUTA is your currency type (eg. USD, EUR, GBP) } } $taxCalc = ($taxRate/100) + 1; $feed_exp_date = date('Y-m-d', time() + 2419200 ); if (!($link=mysql_connect(DB_SERVER,DB_SERVER_USERNAME,DB_SERVER_PASSWORD))) { echo "Error when connecting itself to the data base"; exit(); } if (!mysql_select_db( DB_DATABASE , $link )) { echo "Error the data base does not exist"; exit(); } $quotes = ''; if (QUOTES_CATEGORY_NAME !== '') { $quotes = " and products.customers_email_address = '' and products.quotes_email_address = ''"; } $extraFields = ''; if (OPTIONS_TONEN_BRAND == 1 && strlen(OPTIONS_BRAND) == 0) { //brand is enabled but not set so load from database $extraFields .= ' products.products_brand as brand, '; } if (OPTIONS_TONEN_GTIN == 1 && strlen(OPTIONS_GTIN) == 0) { $extraFields .= ' products.products_gtin as gtin, '; } if (OPTIONS_TONEN_ISBN == 1 && strlen(OPTIONS_ISBN) == 0) { $extraFields .= ' products.products_isbn as isbn, '; } if (OPTIONS_TONEN_UPC == 1 && strlen(OPTIONS_UPC) == 0) { $extraFields .= ' products.products_upc as upc, '; } $sql = " SELECT concat( '" . $productURL . "' ,products.products_id) AS product_url, products_model AS prodModel, manufacturers.manufacturers_name AS mfgName, manufacturers.manufacturers_id, products.products_id AS id, products_description.products_name AS name, products_description.products_description AS description, products.products_quantity AS quantity, products.products_status AS prodStatus, products.products_weight AS prodWeight, " . $extraFields . " FORMAT( IFNULL(specials.specials_new_products_price, products_groups.customers_group_price) * " . $taxCalc . ",2) AS price, CONCAT( '" . $imageURL . "' ,products.products_image) AS image_url, products_to_categories.categories_id AS prodCatID, categories.parent_id AS catParentID, categories_description.categories_name AS catName FROM (categories, categories_description, products, products_description, products_to_categories) left join manufacturers on ( manufacturers.manufacturers_id = products.manufacturers_id ) left join specials on ( specials.products_id = products.products_id AND ( ( (specials.expires_date > CURRENT_DATE) OR (specials.expires_date is NULL) OR (specials.expires_date = 0) ) AND ( specials.status = 1 ) ) ) WHERE products.products_id=products_description.products_id AND products.products_id=products_to_categories.products_id AND products_to_categories.categories_id=categories.categories_id AND categories.categories_id=categories_description.categories_id " . $quotes . " AND categories_description.language_id = " . TAAL_ID_LANGUAGE . " AND products_description.language_id = " . TAAL_ID_LANGUAGE . " ORDER BY products.products_id ASC "; $quotes = ''; if (QUOTES_CATEGORY_NAME !== '') { $quotes = " and categories_description.categories_name NOT LIKE '" . QUOTES_CATEGORY_NAME . "' "; } $catInfo = " SELECT categories.categories_id AS curCatID, categories.parent_id AS parentCatID, categories_description.categories_name AS catName FROM categories, categories_description WHERE categories.categories_id = categories_description.categories_id " . $quotes . " AND categories_description.language_id = " . TAAL_ID_LANGUAGE . ""; function findCat($curID, $catTempPar, $catTempDes, $catIndex) { if( (isset($catTempPar[$curID])) && ($catTempPar[$curID] != 0) ) { if(isset($catIndex[$catTempPar[$curID]])) { $temp=$catIndex[$catTempPar[$curID]]; } else { $catIndex = findCat($catTempPar[$curID], $catTempPar, $catTempDes, $catIndex); $temp = $catIndex[$catTempPar[$curID]]; } } if( (isset($catTempPar[$curID])) && (isset($catTempDes[$curID])) && ($catTempPar[$curID] == 0) ) { $catIndex[$curID] = $catTempDes[$curID]; } else { $catIndex[$curID] = $temp . ", " . $catTempDes[$curID]; } return $catIndex; } $catIndex = array(); $catTempDes = array(); $catTempPar = array(); $processCat = mysql_query( $catInfo )or die( $FunctionName . ": SQL error " . mysql_error() . "| catInfo = " . htmlentities($catInfo) ); while ( $catRow = mysql_fetch_object( $processCat ) ) { $catKey = $catRow->curCatID; $catName = $catRow->catName; $catParID = $catRow->parentCatID; if($catName != "") { $catTempDes[$catKey]=$catName; $catTempPar[$catKey]=$catParID; } } foreach($catTempDes as $curID=>$des) { //don't need the $des $catIndex = findCat($curID, $catTempPar, $catTempDes, $catIndex); } $_strip_search = array( "![~ ]+$|^[~ ]+!m", // remove leading/trailing space chars '%[\r\n]+%m'); // remove CRs and newlines $_strip_replace = array( '', ' '); $_cleaner_array = array(">" => "> ", "®" => "", "®" => "", "™" => "", "™" => "", "~" => "", " " => "", """ => "\""); if ( file_exists( $OutFile ) ) { unlink( $OutFile ); } $output = "link~titel~beschrijving~prijs~afbeeldingslink~id"; $attributesColumns = array(); //create optional section if(OPTIONS_TONEN == 1) { if(OPTIONS_TONEN_AGE_RANGE == 1) $output .= "~age_range"; if(OPTIONS_TONEN_BRAND == 1) $output .= "~merk"; if(OPTIONS_TONEN_CONDITION == 1) $output .= "~staat"; if(OPTIONS_TONEN_CURRENCY == 1) $output .= "~currency"; if(OPTIONS_TONEN_EXPIRATION == 1) $output .= "~vervaldatum"; if(OPTIONS_TONEN_FEED_LANGUAGE == 1) $output .= "~language"; if(OPTIONS_TONEN_FEED_QUANTITY == 1) $output .= "~hoeveelheid"; if(OPTIONS_TONEN_GTIN == 1) $output .= "~gtin"; if(OPTIONS_TONEN_ISBN == 1) $output .= "~isbn"; if(OPTIONS_TONEN_MADE_IN == 1) $output .= "~made_in"; if(OPTIONS_TONEN_MANUFACTURERS_ID == 1) $output .= "~manufacturer"; if(OPTIONS_TONEN_PAYMENT_ACCEPTED == 1) $output .= "~payment_accepted"; if(OPTIONS_TONEN_PRODUCT_MODEL == 1) $output .= "~mpn"; if(OPTIONS_TONEN_PRODUCT_TYPE == 1) $output .= "~producttype"; if(OPTIONS_TONEN_SHIPPING == 1) $output .= "~Google productcategorie "; if(OPTIONS_TONEN_INCLUDE_TAX == 1) $output .= "~tax"; if(OPTIONS_TONEN_UPC == 1) $output .= "~upc"; if(OPTIONS_TONEN_WEIGHT == 1) $output .= "~verzendgewicht"; if (OPTIONS_TONEN_ATTRIBUTES == 1) { $products_options_name_query = mysql_query("select distinct popt.products_options_id, popt.products_options_name from products_options popt, products_attributes patrib where popt.language_id = '" . (int)1 . "' order by popt.products_options_name") or die(mysql_error()); while ($products_options_name = mysql_fetch_object($products_options_name_query)) { $attributesColumns[] = $products_options_name->products_options_name; $name = strtolower($products_options_name->products_options_name); $name = str_replace(" ","_", $name); $output .= "~c:" . $name; } /* //If you want to only show particular attributes, comment out the above and uncomment this section. //Then enter two lines for each one you want to show. For example, if the atttributes you want to //show are named Color and Fabric, the entries would appear as follows: $attributesColumns[] = "Color"; $attributesColumns[] = "Fabric"; $output .= "~c:" . strtolower("Color"); $output .= "~c:" . strtolower("Fabric"); */ } } $output .= "\n"; $result=mysql_query( $sql )or die( $FunctionName . ": SQL error " . mysql_error() . "| sql = " . htmlentities($sql) ); //Currency Information if(CONVERT_CURRENCY) { $sql3 = " SELECT currencies.value AS curEUR FROM currencies WHERE currencies.code = '" . VALUTA . "'"; $result3=mysql_query( $sql3 )or die( $FunctionName . ": SQL error " . mysql_error() . "| sql3 = " . htmlentities($sql3) ); $row3 = mysql_fetch_object( $result3 ); } $loop_counter = 0; while( $row = mysql_fetch_object( $result ) ) { if (OPTIONS_IGNORE_PRODUCT_ZERO > 0 && $row->quantity < 1) continue; //skip products with 0 qty if (isset($already_sent[$row->id])) continue; // if we've sent this one, skip the rest of the while loop if ( $row->prodStatus == 1 ) { if (CONVERT_CURRENCY) { $row->price = preg_replace("/[^.0-9]/", "", $row->price); $row->price = $row->price * $row3->curEUR; $row->price = number_format($row->price, 2, '.', ','); } $google_utm = (OPTIONS_TONEN_GOOGLE_UTM ? OPTIONS_DEFAULT_GOOGLE_UTM : ''); if(SEO_URLS_GEBRUIKEN=='true'){ $output .= tep_href_link($productURL,$productParam . $row->id) . $google_utm . "~" . strip_tags($row->name) . "~" . preg_replace("/\s+[^a-zA-Z0-9]/", "", $row->description) . "~" . $row->price . "~" . $row->image_url . "~" . // $catIndex[$row->prodCatID] . "~" . $row->id; } else { $output .= $row->product_url . $google_utm . "~" . strip_tags($row->name) . "~" . preg_replace("/\s+[^a-zA-Z0-9]/", "", $row->description) . "~" . $row->price . "~" . $row->image_url . "~" . // $catIndex[$row->prodCatID] . "~" . $row->id; } //optional values section if(OPTIONS_TONEN == 1) { if(OPTIONS_TONEN_AGE_RANGE == 1) $output .= "~" . OPTIONS_AGE_RANGE; if(OPTIONS_TONEN_BRAND == 1) // $output .= "~" . (isset($row->brand) ? $row->brand : (strlen(OPTIONS_BRAND) ? OPTIONS_BRAND : "Not Supported")); // $output .= "~" . (isset($row->mfgName) ? $row->mfgName : (strlen(OPTIONS_BRAND) ? OPTIONS_BRAND : "Not Supported")); $output .= "~" . (in_array($row->mfgName,explode(",",OPTIONS_MANUFACTURERS_NAME)) ? '' : $row->mfgName); // $output .= "~" . (in_array($row->mfgName,explode(",",OPTIONS_MANUFACTURERS_NAME)) ? '' : $row->mfgName); if(OPTIONS_TONEN_CONDITION == 1) $output .= "~" . OPTIONS_CONDITION; if(OPTIONS_TONEN_CURRENCY == 1) $output .= "~" . OPTIONS_DEFAULT_CURRENCY; if(OPTIONS_TONEN_EXPIRATION == 1) $output .= "~" . $feed_exp_date; if(OPTIONS_TONEN_FEED_LANGUAGE == 1) $output .= "~" . OPTIONS_DEFAULT_FEED_LANGUAGE; if(OPTIONS_TONEN_FEED_QUANTITY == 1) $output .= "~" . $row->quantity; if(OPTIONS_TONEN_GTIN == 1) $output .= "~" . (isset($row->gtin) ? $row->gtin : (strlen(OPTIONS_GTIN) ? OPTIONS_GTIN : "Not Supported")); if(OPTIONS_TONEN_ISBN == 1) $output .= "~" . (isset($row->isbn) ? $row->isbn : (strlen(OPTIONS_ISBN) ? OPTIONS_ISBN : "Not Supported")); if(OPTIONS_TONEN_MADE_IN == 1) $output .= "~" . OPTIONS_MADE_IN; if(OPTIONS_TONEN_MANUFACTURERS_ID == 1) //$output .= "~" . (in_array($row->mfgName,explode(",",OPTIONS_MANUFACTURERS_NAME)) ? '' : $row->mfgName); $output .= "~" . nl2br($row->prodModel); if(OPTIONS_TONEN_PAYMENT_ACCEPTED == 1) $output .= "~" . OPTIONS_PAYMENT_ACCEPTED_METHODS; if(OPTIONS_TONEN_PRODUCT_MODEL == 1) $output .= "~" . $row->prodModel; if(OPTIONS_TONEN_PRODUCT_TYPE == 1) $output .= "~" . ((OPTIONS_PRODUCT_TYPE == strtolower('full')) ? $catIndex[$row->prodCatID] : $row->catName); if(OPTIONS_TONEN_SHIPPING == 1) $output .= "~" . ((OPTIONS_PRODUCT_TYPE == strtolower('full')) ? $catIndex[$row->prodCatID] : $row->catName); if(OPTIONS_TONEN_INCLUDE_TAX == 1) $output .= "~" . OPTIONS_TAX_STRING; if(OPTIONS_TONEN_UPC == 1) $output .= "~" . (isset($row->upc) ? $row->upc : (strlen(OPTIONS_UPC) ? OPTIONS_UPC : "Not Supported")); if(OPTIONS_TONEN_WEIGHT == 1) $output .= "~" . $row->prodWeight . ' ' .OPTIONS_WEIGHT_ACCEPTED_METHODS; /******************* BEGIN HANDLING THE ATTRIBUTES ********************/ if (OPTIONS_TONEN_ATTRIBUTES == 1) { $products_attributes_query = mysql_query("select count(*) as total from products_options popt, products_attributes patrib where patrib.products_id='" . $row->id . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)1 . "'"); $products_attributes = mysql_fetch_object($products_attributes_query); if ($products_attributes->total > 0) { $products_options_name_query = mysql_query("select distinct popt.products_options_id, popt.products_options_name from products_options popt, products_attributes patrib where patrib.products_id='" . (int)$row->id . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)1 . "' order by popt.products_options_name") or die(mysql_error()); $trackTabs = ''; while ($products_options_name = mysql_fetch_object($products_options_name_query)) { $products_options_array = array(); $products_options_query = mysql_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from products_attributes pa, products_options_values pov where pa.products_id = '" . (int)$row->id . "' and pa.options_id = '" . $products_options_name->products_options_id . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)1 . "'"); while ($products_options = mysql_fetch_object($products_options_query)) { $products_options_array[] = array('id' => $products_options->products_options_values_id, 'text' => $products_options->products_options_values_name); } for ($a = 0; $a < count($attributesColumns); ++$a) { if ($products_options_name->products_options_name == $attributesColumns[$a]) { if ($a == 0) $trackTabs = "~"; else { if (empty($trackTabs)) $trackTabs = str_repeat("~", $a); $trackTabs .= "~"; } $output .= $trackTabs; foreach ($products_options_array as $arr) $output .= $arr['text'] . ','; $output = substr($output, 0, -1); } } } } } /******************* END HANDLING THE ATTRIBUTES ********************/ } $output .= " \n"; } $already_sent[$row->id] = 1; $loop_counter++; if ($loop_counter>750) { $fp = fopen( $OutFile , "a" ); $fout = fwrite( $fp , $output ); fclose( $fp ); $loop_counter = 0; $output = ""; } } $fp = fopen( $OutFile , "a" ); $fout = fwrite( $fp , $output ); fclose( $fp ); echo "<table><tr><td><img src=\"images/google-shopping.jpg\" alt=\"Google Shopping\" align=\"left\"></td><td style=\"font-family: verdana; font-size:11px;\"><b>Google shopping feed is geupdate!</b><br><br>Bestand: <a href=\"" . $OutFile . "\" target=\"_blank\">" . $destination_file . "</a></td></tr></table>\n"; chmod($OutFile, 0777); //Start FTP function ftp_file( $ftpservername, $ftpusername, $ftppassword, $ftpsourcefile, $ftpdirectory, $ftpdestinationfile ) { // set up basic connection $conn_id = ftp_connect($ftpservername); if ( $conn_id == false ) { echo "FTP open connection failed to $ftpservername <BR>\n" ; return false; } // login with username and password $login_result = ftp_login($conn_id, $ftpusername, $ftppassword); // check connection if ((!$conn_id) || (!$login_result)) { echo "FTP connection has failed!<BR>\n"; echo "Attempted to connect to " . $ftpservername . " for user " . $ftpusername . "<BR>\n"; return false; } else { echo "Connected to " . $ftpservername . ", for user " . $ftpusername . "<BR>\n"; } if ( strlen( $ftpdirectory ) > 0 ) { if (ftp_chdir($conn_id, $ftpdirectory )) { echo "Current directory is now: " . ftp_pwd($conn_id) . "<BR>\n"; } else { echo "Couldn't change directory on $ftpservername<BR>\n"; return false; } } ftp_pasv ( $conn_id, true ) ; // upload the file $upload = ftp_put( $conn_id, $ftpdestinationfile, $ftpsourcefile, FTP_ASCII ); // check upload status if (!$upload) { echo "$ftpservername: FTP upload is mislukt!<BR>\n"; return false; } else { echo "Uploaded " . $ftpsourcefile . " naar " . $ftpservername . " als " . $ftpdestinationfile . "<BR>\n"; } // close the FTP stream ftp_close($conn_id); return true; } if (FTP_ENABLED) ftp_file( "uploads.google.com", FTP_USERNAME, FTP_PASSWORD, $source_file, "", $destination_file); //End FTP // --------- $etimer = explode( ' ', microtime() ); $etimer = $etimer[1] + $etimer[0]; echo '<p style="font-family: verdana; font-size:11px; margin:auto; text-align:center">'; printf( "Feed is gemaakt in: <b>%f</b> seconden.", ($etimer-$stimer) ); echo '</p>'; // --------- /* ?> The line: FORMAT( IFNULL(specials.specials_new_products_price, products_groups.customers_group_price) * " . $taxCalc . ",2) AS price, Is the line that is not working, that either happened because the database is not allowing me acces to that table and column or it is because every entry in that column has 3 different values. Let me explain The table PRODUCTS_GROUPS has 3 columns, "product_id", "customers_group_price" and "customers_group_id", that last column is what i want, but there is also the customers_group_id, that has 3 different values, and all i want is to take only the prices from "customers_group_price" that have a ID 0 in the "customers_group_id" From another script on my site i have this code <?php } else { // $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); // $product_info = tep_db_fetch_array($product_info_query); $product_info_query = tep_db_query("select p.products_new, p.algam_products_number, p.products_id, pd.products_youtube, p.products_levertijd_aanvraag, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id, p.products_availability_id, p.products_subimage1, p.products_subimage2, p.products_subimage3, p.products_subimage4, p.products_subimage5, p.products_subimage6, pd.products_sound, pd.products_video, p.products_quantity from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); $product_info = tep_db_fetch_array($product_info_query); tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'"); // BOF Separate Price per Customer $scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id']. "' and customers_group_id = '" . $customer_group_id . "'"); if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) { if ($customer_group_id == 2) { $sql = "select * from customers_dealer_manufacturers where customers_id=".(int)$customer_id." and manufacturers_id=".(int)$product_info['manufacturers_id']; $q = tep_db_query($sql); if ($r = tep_db_fetch_array($q)) { $product_info['products_price']= $scustomer_group_price['customers_group_price']; } } else { $product_info['products_price']= $scustomer_group_price['customers_group_price']; } } So the way, this last script gets it's price, that is how MY script should get his price, so how do i do this ?
  4. I've been working on this since my last post, but i am still a little puzzled. There are some things not working right in this script. -I do not see all the brands from the particular group in the dropdown, only see the brands that are currently on the page, if i go to the next page i see more brands, but if i go back again i see only the first page brands. -The links in the dropdown are clickable but do not point anywhere, i wanted to make a offset behind my link that will search for the brand and only displays the brand but i do not know how to do that -Some of the brands are double in the dropdownlist, also they are not sorted :-( Here is the website: http://www.dwmusicstore.com/mark2/occasiona.php And here is the script: <html> <head> </head> <body bgcolor=#E2E965 link=black vlink=black alink=black text=#D5DF23> <style type="text/css"> #nav, #nav ul { padding: 0; margin: 0; list-style: none; } #nav li { float: left; width: 120px; } #nav ul { position: absolute; width: 120px; left: -1000px; } #nav li:hover ul { left: auto; } <!-- a {text-decoration:none} //--> body { scrollbar-arrow-color: #E2E965; scrollbar-face-color: #D7182A; scrollbar-highlight-color: #000000; scrollbar-3dlight-color: #D6DF23; scrollbar-shadow-color: #00000; scrollbar-darkshadow-color: #00000; scrollbar-track-color: #D6DF23; } input:link {text-decoration: none; color: #E2E965;} input:visited {text-decoration: none; color: #E2E965;} input:active {text-decoration: none; color: #E2E965;} .spacer_black { margin: 0px; padding: 0px; border: 5px; height: 2px; width: 100%; line-height: 0px; font-size: 0px; background-color: #000000;} </style> <table width=800 border=0><td> <?PHP // PHP code loading the CSV file, than dividing it in parts, also counting how many products are shown on the page. $SelectArray=array(); $offset = isset($_GET['offset'])?$_GET['offset']:0; $LinesToDisplay = 12; $row = $offset + $LinesToDisplay; $row2 = $offset - $LinesToDisplay; $file_handle = fopen("web.txt", "rb"); error_reporting( E_ALL ); // DEBUGGING while ((($parts = fgetcsv($file_handle,4096,"|")) !== FALSE) && ($LinesToDisplay > 0) && (!feof($file_handle))) { $SelectArray[]=$parts[6]; //new code //skip first $offset lines $num = count($parts[6]); //giving $parts[5] (group number) it's number if ($parts[5] == 9999) { if ($offset-- > 0) {continue;} //making $parts[0] & $parts[1] lowercase $parts[0] = ucwords(strtolower($parts[0])); $parts[1] = ucwords(strtolower($parts[1])); ?> <td> <?php //creating a small table cell where the $parts are being displayed echo "<table BACKGROUND='background.jpg' border=0 width=250><td width='243' height='105'>"; echo "<font size=-1 face='helvetica' color=#812990><b>$parts[0]</b></font>"; echo "<i>"; ?> <div onMouseOver="this.style.color = 'black';" onMouseOut="this.style.color = '#D5DF23';"> <?php //displaying the $parts[1] which has a mouseover and closing the DIV echo "<font size=2>-$parts[1]</font>"; echo "</div></i>"; //displaying 2 clickable buttons, 1 for questions and the other for ordering the products, they have a title mouseover ?> <a href="#" title="Koop nu de <?php echo $parts[0]; ?>" onClick="window.open('form.php?p=<?php echo urlencode($parts[0]); ?>','popuppage','width=400,height=400,top=250,left=250,resizable=0,statusbar=0,titlebar=yes,toolbar=no,scrollbars=no,location=no,directories=no');"> <div><img src='ster.jpg' border=0 width='46' align='right'></a> <a href="#"><img src='envelope.jpg' border=0 width='46' align='right'title="Heeft u een vraag over de<?php echo $parts[0]; ?>" onClick="window.open('vraag.php?p=<?php echo urlencode($parts[0]); ?>','popuppage','width=400,height=400,top=250,left=250,resizable=0,statusbar=0,titlebar=yes,toolbar=no,scrollbars=no,location=no,directories=no');"> </div></a> <TABLE BORDER='0' cellpadding='0' CELLSPACING='0'> <TR> <TD WIDTH='70' HEIGHT='20' BACKGROUND='pricebackground.jpg' VALIGN='bottom'> <center> <font size=2 color=white face='helvetica'> <b> <?php //displaying the price in a little red cell echo "€ $parts[2]"; ?> </b> </td> </tr> </table> <?php //displaying the stock value's in both the stores echo "<b><font size=3 color=#D7182A>Op Voorraad In:<br></font>"; echo ("<font color=black> Amsterdam </font>"); if ( $parts[3] >= 1 ) echo ("<IMG SRC =green.gif>").""; if ( $parts[3] <= 0 ) echo ("<IMG SRC =red.gif>").""; echo ("<font color=black> Utrecht </font>"); if ( $parts[4] >= 1 ) echo ("<IMG SRC =green.gif>")."</td></table></b><p style='margin:9px;'>"; if ( $parts[4] <= 0 ) echo ("<IMG SRC =red.gif>")."</td></table></b><p style='margin:9px;'>"; //displaying how many products are shown $LinesToDisplay--; if ($LinesToDisplay/3==intval($LinesToDisplay/3)) { echo "<tr><td>"; } }} fclose($file_handle); ?> <tr align=right> <form name=jump> <select name="menu" style="background-color: #FFFFFF; color: #000000; font-family: Arial; font-weight: none; font-size: 12; width: 150px; "> <?php //dropdown menu showing the brands, at the moment not showing all the brands from the group, links are not good directed foreach ($SelectArray as $val){ echo "<option value=\"?offset=$val\">$val</option>\n"; $i++; } ?> </select> <input type="button" onClick="location=document.jump.menu.options[document.jump.menu.selectedIndex].value;" value="GO"></form> <font color=black><body alink=black vlink=black link=black text=black> <center><a href="occasiona.php?offset=<?php echo $row2; ?>" align=center>« previous</a> || <a href="occasiona.php?offset=<?php echo $row; ?>">next »</a></table></html>
  5. Now the question is how to program it, i find it very difficult. The javascript part i can manage, i mean, i can make the brands clickable, but i do not know where to click them too
  6. The problem is now, that the brands are not clickable, maybe i didn't explain it too well ;-) I need the brands to be clickable so that people can sort the page easier. The other problem is that it only shows the brands from products that are currently loaded into the page, if i press on next page, i get more brands, but i need all the brands to be there, loaded at the first page, is that possible ?
  7. I found the problem and the page loads without errors, i can see the dropdown list, and i can select the brands but then nothing happens. Here is the new code: <html> <head> </head> <body bgcolor=#E2E965 link=black vlink=black alink=black text=#D5DF23> <style type="text/css"> #nav, #nav ul { padding: 0; margin: 0; list-style: none; } #nav li { float: left; width: 120px; } #nav ul { position: absolute; width: 120px; left: -1000px; } #nav li:hover ul { left: auto; } <!-- a {text-decoration:none} //--> body { scrollbar-arrow-color: #E2E965; scrollbar-face-color: #D7182A; scrollbar-highlight-color: #000000; scrollbar-3dlight-color: #D6DF23; scrollbar-shadow-color: #00000; scrollbar-darkshadow-color: #00000; scrollbar-track-color: #D6DF23; } input:link {text-decoration: none; color: #E2E965;} input:visited {text-decoration: none; color: #E2E965;} input:active {text-decoration: none; color: #E2E965;} .spacer_black { margin: 0px; padding: 0px; border: 5px; height: 2px; width: 100%; line-height: 0px; font-size: 0px; background-color: #000000;} </style> <table width=800 border=0><td> </html> <?PHP $offset = isset($_GET['offset'])?$_GET['offset']:0; $LinesToDisplay = 12; $row = $offset + $LinesToDisplay; $row2 = $offset - $LinesToDisplay; $file_handle = fopen("web.txt", "rb"); error_reporting( E_ALL ); // DEBUGGING $SelectArray=array(); while ((($parts = fgetcsv($file_handle,4096,"|")) !== FALSE) && ($LinesToDisplay > 0) && (!feof($file_handle))) { //new code //skip first $offset lines $num = count($parts[6]); $SelectArray[]=$parts[6]; if ($parts[5] == 9999) { if ($offset-- > 0) {continue;} $parts[0] = ucwords(strtolower($parts[0])); $parts[1] = ucwords(strtolower($parts[1])); ?> <td> <?php echo "<table BACKGROUND='background.jpg' border=0 width=250><td width='243' height='105'>"; echo "<font size=-1 face='helvetica' color=#812990><b>$parts[0]</b></font>"; echo "<i>"; ?> <html> <div onMouseOver="this.style.color = 'black';" onMouseOut="this.style.color = '#D5DF23';"></html><?php echo "<font size=2>-$parts[1]</font>"; echo "</div></i>"; ?><html><a href="#" title="Koop nu de <?php echo $parts[0]; ?>" onClick="window.open('form.php?p=<?php echo urlencode($parts[0]); ?>','popuppage','width=400,height=400,top=250,left=250,resizable=0,statusbar=0,titlebar=yes,toolbar=no,scrollbars=no,location=no,directories=no');"> <div><img src='ster.jpg' border=0 width='46' align='right'></a> <a href="#"><img src='envelope.jpg' border=0 width='46' align='right'title="Heeft u een vraag over <?php echo $parts[0]; ?>" onClick="window.open('vraag.php?p=<?php echo urlencode($parts[0]); ?>','popuppage','width=400,height=400,top=250,left=250,resizable=0,statusbar=0,titlebar=yes,toolbar=no,scrollbars=no,location=no,directories=no');"> <div></a> <TABLE BORDER='0' cellpadding='0' CELLSPACING='0'> <TR> <TD WIDTH='70' HEIGHT='20' BACKGROUND='pricebackground.jpg' VALIGN='bottom'> <center> <font size=2 color=white face='helvetica'> <b></html> <?php echo "€ $parts[2]"; ?> </b> </td> </tr> </table> <?php echo "<b><font size=3 color=#D7182A>Op Voorraad In:<br></font>"; echo ("<font color=black> Amsterdam </font>"); if ( $parts[3] >= 1 ) echo ("<IMG SRC =green.gif>").""; if ( $parts[3] <= 0 ) echo ("<IMG SRC =red.gif>").""; echo ("<font color=black> Utrecht </font>"); if ( $parts[4] >= 1 ) echo ("<IMG SRC =green.gif>")."</td></table></b><p style='margin:9px;'>"; if ( $parts[4] <= 0 ) echo ("<IMG SRC =red.gif>")."</td></table></b><p style='margin:9px;'>"; $LinesToDisplay--; if ($LinesToDisplay/3==intval($LinesToDisplay/3)) { echo "<tr><td>"; } }} fclose($file_handle); ?> <tr align=right> <select style="background-color: #FFFFFF; color: #000000; font-family: Arial; font-weight: none; font-size: 12; width: 150px; "> <?php $i=1; foreach ($SelectArray as $val){ echo "<option value=\"$i\">$val</option>\n"; $i++; } ?> </select> <font color=black><body alink=black vlink=black link=black text=black> <center><a href="occasiona.php?offset=<?php echo $row2; ?>" align=center>« previous</a> || <a href="occasiona.php?offset=<?php echo $row; ?>">next »</a></table></html>
  8. Hi think you for your help, but i am getting a Parse error: syntax error, unexpected T_ARRAY, expecting T_STRING or T_VARIABLE or '$' in occasiona.php on line 95 It is this line: $SelectArray=new array(); But i do not know how to resolve that.
  9. Hi, i have a script that loads a CSV file and divides it in parts. It is made for a music store so it has: the name of the product the subname the price the stock in one shop the stock of the other shop the group name the brandname What i have now is that the products are being shown in one lightbox, 12 products to be precise, with a next and previous button The products that are shown are the products that are sorted from the group. So there are different pages to choose from, from the website, depending on the group number What i like to have is that there is a dropdown list in top of the page, with ALL the brands from that precise group, so if chosen, only the products from that brand are shown. I have the dropdown menu, and i can load a $part[6], but it only shows the brand of one product, there is no list. Can someone point me in the right direction ? Here is the script: <html> <head> </head> <body bgcolor=#E2E965 link=black vlink=black alink=black text=#D5DF23> <style type="text/css"> #nav, #nav ul { padding: 0; margin: 0; list-style: none; } #nav li { float: left; width: 120px; } #nav ul { position: absolute; width: 120px; left: -1000px; } #nav li:hover ul { left: auto; } <!-- a {text-decoration:none} //--> body { scrollbar-arrow-color: #E2E965; scrollbar-face-color: #D7182A; scrollbar-highlight-color: #000000; scrollbar-3dlight-color: #D6DF23; scrollbar-shadow-color: #00000; scrollbar-darkshadow-color: #00000; scrollbar-track-color: #D6DF23; } input:link {text-decoration: none; color: #E2E965;} input:visited {text-decoration: none; color: #E2E965;} input:active {text-decoration: none; color: #E2E965;} .spacer_black { margin: 0px; padding: 0px; border: 5px; height: 2px; width: 100%; line-height: 0px; font-size: 0px; background-color: #000000;} </style> <table width=800 border=0><td> </html> <?PHP $offset = isset($_GET['offset'])?$_GET['offset']:0; $LinesToDisplay = 12; $row = $offset + $LinesToDisplay; $row2 = $offset - $LinesToDisplay; $file_handle = fopen("web.txt", "rb"); error_reporting( E_ALL ); // DEBUGGING while ((($parts = fgetcsv($file_handle,4096,"|")) !== FALSE) && ($LinesToDisplay > 0) && (!feof($file_handle))) { //new code //skip first $offset lines $num = count($parts[6]); if ($parts[5] == 9999) { if ($offset-- > 0) {continue;} $parts[0] = ucwords(strtolower($parts[0])); $parts[1] = ucwords(strtolower($parts[1])); ?> <td> <?php echo "<table BACKGROUND='background.jpg' border=0 width=250><td width='243' height='105'>"; echo "<font size=-1 face='helvetica' color=#812990><b>$parts[0]</b></font>"; echo "<i>"; ?> <html> <div onMouseOver="this.style.color = 'black';" onMouseOut="this.style.color = '#D5DF23';"></html><?php echo "<font size=2>-$parts[1]</font>"; echo "</div></i>"; ?><html><a href="#" title="Koop nu de <?php echo $parts[0]; ?>" onClick="window.open('form.php?p=<?php echo urlencode($parts[0]); ?>','popuppage','width=400,height=400,top=250,left=250,resizable=0,statusbar=0,titlebar=yes,toolbar=no,scrollbars=no,location=no,directories=no');"> <div><img src='ster.jpg' border=0 width='46' align='right'></a> <a href="#"><img src='envelope.jpg' border=0 width='46' align='right'title="Heeft u een vraag over <?php echo $parts[0]; ?>" onClick="window.open('vraag.php?p=<?php echo urlencode($parts[0]); ?>','popuppage','width=400,height=400,top=250,left=250,resizable=0,statusbar=0,titlebar=yes,toolbar=no,scrollbars=no,location=no,directories=no');"> <div></a> <TABLE BORDER='0' cellpadding='0' CELLSPACING='0'> <TR> <TD WIDTH='70' HEIGHT='20' BACKGROUND='pricebackground.jpg' VALIGN='bottom'> <center> <font size=2 color=white face='helvetica'> <b></html> <?php echo "€ $parts[2]"; ?> </b> </td> </tr> </table> <?php echo "<b><font size=3 color=#D7182A>Op Voorraad In:<br></font>"; echo ("<font color=black> Amsterdam </font>"); if ( $parts[3] >= 1 ) echo ("<IMG SRC =green.gif>").""; if ( $parts[3] <= 0 ) echo ("<IMG SRC =red.gif>").""; echo ("<font color=black> Utrecht </font>"); if ( $parts[4] >= 1 ) echo ("<IMG SRC =green.gif>")."</td></table></b><p style='margin:9px;'>"; if ( $parts[4] <= 0 ) echo ("<IMG SRC =red.gif>")."</td></table></b><p style='margin:9px;'>"; $LinesToDisplay--; if ($LinesToDisplay/3==intval($LinesToDisplay/3)) { echo "<tr><td>"; } }} fclose($file_handle); ?> <tr align=right> <select style="background-color: #FFFFFF; color: #000000; font-family: Arial; font-weight: none; font-size: 12; width: 150px; "> <option value="1"><?php echo $parts[6]; ?> </option> </select> <font color=black><body alink=black vlink=black link=black text=black> <center><a href="occasiona.php?offset=<?php echo $row2;?>" align=center>« previous</a> || <a href="occasiona.php?offset=<?php echo $row;?>">next »</a></table></html>
  10. Here is the link to the website: http://www.dwmusicstore.com/mark if you press the downleft cube, the lightbox pops up. You can see that it only has 3 pages but when you click inside the lightbox on the next or previous it has more pages
  11. sorry, i didn't put the original script in it <HTML> <title> Dirk Witte Muziekinstrumenten </title> <head> <meta name="description" content="Dirk Witte Muziekinstrumenten" /> <meta name="keywords" content="gitaar,drums,toetsen,microfoons,speakers,monitoren,hoofdtelefoons,kabels,snaren,stokken,vellen,marshall,fender,roland,boss,LTD,ESP,taylor,gibson,epiphone,squier, gretsch,ibanez,line6,dirk,witte,muziek,muziekinstrumenten,dwmusicstore,www.dirkwitte.nl,wwww.dirkwitte.com" /> <meta name="author" content="M.E.D." /> <meta name="google-site-verification" content="ww1z4tjoXkb-kCvqsxq2STkXyrlRMABIMazPcY2kBUw" /> <link rel="stylesheet" href="scripts/vlightbox.css" type="text/css" /> <style type="text/css">#vlightbox a#vlb{display:none}</style> <link rel="stylesheet" href="scripts/visuallightbox.css" type="text/css" media="screen" /> <script src="scripts/jquery.min.js" type="text/javascript"></script> <script type="text/javascript" language="javascript" src="scripts/lytebox.js"></script> <link rel="stylesheet" href="scripts/lytebox.css" type="text/css" media="screen" /> <style type="text/css"> iframe { overflow-x: hidden; overflow-y: auto; } body { background-image:url('http://www.dwmusicstore.com/images/background_top.gif'); background-repeat:repeat-x; } img { margin: 0px; padding: 0px; } img { border: none; } a { margin: 0px; padding: 0px; } </style> </head> <center> <body link=#D5DF23 vlink=#D5DF23 alink=#D5DF23> <!-- Start of StatCounter Code --> <script type="text/javascript"> var sc_project=4267393; var sc_invisible=1; var sc_partition=46; var sc_click_stat=1; var sc_security="90426186"; </script> <script type="text/javascript" src="http://www.statcounter.com/counter/counter.js"></script><noscript><div class="statcounter"><a title="blogger visitor" href="http://www.statcounter.com/blogger/" target="_blank"><img class="statcounter" src="http://c.statcounter.com/4267393/0/90426186/1/" alt="blogger visitor" ></a></div></noscript> <!-- End of StatCounter Code --> <TABLE width="950" height="900" align="center" bgcolor="#D5DF23" BORDER=3> <td valign="top"> <table width="920" height="250" border="0" align="center" border=1 bgcolor="#D5DF23"> <TR> <TD COLSPAN=3> <center> <a href="http://maps.google.nl/maps?q=Dirk+witte+amsterdam&hl=nl&cd=1&ei=cYA_S8yyH9agsgah7s2iAw&ie=UTF8&view=map&cid=16549634945791709695&iwloc=A&ved=0CBgQpQY&sa=X" target=_blank title="Locate Dirk Witte Amsterdam on a map"><img src="logo1.jpg" border="0"></a><a href="index.php" title="Home Again"><img src="logo2.jpg" border="0"></a><a href="http://maps.google.nl/maps/ms?hl=nl&source=hp&ie=UTF8&vps=1&jsv=196c&oe=UTF8&msa=0&msid=108039610706462014384.00047c33fffbe3d1a4666" target=_blank title="Locate Dirk Witte Utrecht on a map"><img src="logo3.jpg" border="0"></a> <center><font face=helvetica><b><marquee>Welkom op de nieuwe website van Dirk Witte, wij wensen u veel plezier met het bekijken van ons assortiment.</marquee></b></font></TD> </center> </TD> </TR> <tr> <Td width="300" height="435" background="left.jpg" align=top><center> <iframe width="250" height="450" src="sidebar.php" name="left" frameborder="0" align=top scrolling="no" ></iframe></center></Td> <td rowspan=3 width=700 height=700 background="mid.jpg" align=center> <iframe width="300" height="680" src="midden.php" name="midden" frameborder="0"></iframe></center></td> <Td width="300" height="435" background="right.jpg"><center> <iframe width="250" height=70" src="searcher.php" name="left" frameborder="0" align=top scrolling="no"></iframe> <iframe width="250" height="350" src="sidebar2.php" name="right" frameborder="0" scrolling="no" align=top></iframe></center></Td> </TR> <TR> <TD height="150" bgcolor="#D5DF23"><a rel="lyteframe[catalog]" href="hollow2.php" rev="width: 900px; height: 650px; scrolling: auto" target=_blank><img src="below1.jpg" border=0 width=275 title="Klik hier voor foto's" ></TD> <div id="vlightbox"> <TD height="150" bgcolor="#D5DF23"><p><a rel="lightbox_utr" href="images/ut/1.jpg" target=_blank><img src="below3.jpg" border=0 width=275 align=right HSPACE=10 title="Klik hier voor foto's" ></TD> </TR> </TABLE> <?PHP $offset = isset($_GET['offset'])?$_GET['offset']:0; $LinesToDisplay = 20; $row = $offset + $LinesToDisplay; $row2 = $offset - $LinesToDisplay; $file_handle = fopen("web.txt", "rb"); error_reporting( E_ALL ); // DEBUGGING while ((($parts = fgetcsv($file_handle,4096,"|")) !== FALSE) && ($LinesToDisplay > 0) && (!feof($file_handle))) { //new code //skip first $offset lines $num = count($parts[5]); if ($parts[5] == 4010) { if ($offset-- > 0) {continue;} $parts[0] = ucwords(strtolower($parts[0])); $parts[1] = ucwords(strtolower($parts[1])); $LinesToDisplay--; }} fclose($file_handle); ?> <a rel="lyteframe[catalog]" href="hollow2.php?offset=<?php echo $row;?>" rev="width: 900px; height: 650px; scrolling: auto"</a> <a rel="lyteframe[catalog]" href="hollow2.php?offset=<?php echo $row+$row;?>" rev="width: 900px; height: 650px; scrolling: auto" </a> <a rel="lightbox_ams" href="images/am/2.jpg"></a> <a rel="lightbox_ams" href="images/am/3.jpg"></a> <a rel="lightbox_ams" href="images/am/4.jpg"></a> <a rel="lightbox_ams" href="images/am/5.jpg"></a> <a rel="lightbox_ams" href="images/am/6.jpg"></a> <a rel="lightbox_ams" href="images/am/7.jpg"></a> <a rel="lightbox_ams" href="images/am/8.jpg"></a> <a rel="lightbox_ams" href="images/am/9.jpg"></a> <a rel="lightbox_ams" href="images/am/a.jpg"></a> <a rel="lightbox_ams" href="images/am/b.jpg"></a> <a rel="lightbox_ams" href="images/am/c.jpg"></a> <a rel="lightbox_ams" href="images/am/d.jpg"></a> <a rel="lightbox_ams" href="images/am/e.jpg"></a> <a rel="lightbox_ams" href="images/am/f.jpg"></a> <a rel="lightbox_ams" href="images/am/g.jpg"></a> <a rel="lightbox_ams" href="images/am/h.jpg"></a> <a rel="lightbox_ams" href="images/am/i.jpg"></a> <a rel="lightbox_utr" href="images/ut/2.jpg"></a> <a rel="lightbox_utr" href="images/ut/3.jpg"></a> <a rel="lightbox_utr" href="images/ut/4.jpg"></a> <a rel="lightbox_utr" href="images/ut/5.jpg"></a> <a rel="lightbox_utr" href="images/ut/6.jpg"></a> <a rel="lightbox_utr" href="images/ut/7.jpg"></a> <a rel="lightbox_utr" href="images/ut/8.jpg"></a> <a rel="lightbox_utr" href="images/ut/9.jpg"></a> <a rel="lightbox_utr" href="images/ut/a.jpg"></a> <a rel="lightbox_utr" href="images/ut/b.jpg"></a> <a rel="lightbox_utr" href="images/ut/c.jpg"></a> <a rel="lightbox_utr" href="images/ut/d.jpg"></a> <a rel="lightbox_utr" href="images/ut/e.jpg"></a> <a rel="lightbox_utr" href="images/ut/f.jpg"></a> <a rel="lightbox_utr" href="images/ut/g.jpg"></a> <a rel="lightbox_utr" href="images/ut/h.jpg"></a> <a rel="lightbox_utr" href="images/ut/i.jpg"></a> <a rel="lightbox_utr" href="images/ut/j.jpg"></a> <a rel="lightbox_utr" href="images/ut/k.jpg"></a> <a rel="lightbox_utr" href="images/ut/l.jpg"></a> <script src="scripts/visuallightbox.js" type="text/javascript"></script> </div>
  12. Hi, i have this nice script that reads a CSV, it does a pagination, that is coded like this: <script language="Javascript"> <!-- if (document.images) { image1 = new Image image2 = new Image image1.src = 'vorige1.jpg' image2.src = 'vorige2.jpg' image3 = new Image image4 = new Image image3.src = 'volgende1.jpg' image4.src = 'volgende2.jpg' } --> </script> </head> </body> <center><a href="hollow.php?offset=-30" onMouseOver="document.mouseover.src=image2.src" onMouseOut="document.mouseover.src=image1.src"><img src="vorige1.jpg" border=0 name="mouseover"></a> <a href="hollow.php?offset=30" onMouseOver="document.mouseover2.src=image4.src" onMouseOut="document.mouseover2.src=image3.src"><img src="volgende1.jpg" border=0 name="mouseover2"></a> Also i have a alternate version of the lightbox, called Lytebox...which is actually very cool. What i want to do is, and i hope i can explain it, is to use the pagination inside the lightbox. I've tried it but the problem is that my scripts reads a CSV, inside there are products, the amount of these products change daily. I read like 30 products on one page, and then the offset shows the next 30. And this goes on and on, even when there are no more products it still goes to the next page, but that's ok. What is not ok is that for the lytebox to work properly, i have to determine in front, how many pages i am going to make. And it will end up like this: <a rel="lyteframe[catalog]" href="hollow2.php" rev="width: 900px; height: 650px; scrolling: auto" target=_blank> <a rel="lyteframe[catalog]" href="hollow2.php?offset=30" rev="width: 900px; height: 650px; scrolling: auto"</a> <a rel="lyteframe[catalog]" href="hollow2.php?offset=60" rev="width: 900px; height: 650px; scrolling: auto" </a> Is there a trick, because the lytebox looks inside the script if there are more <a rel="lyteframe[catalog]" entries, and if i press next, it goes to the next entry...so what i want/need/love is that i do not have to make these entries inside my script but that the lytebox automatically, when i press next, goes to the next offset I hope i explained it correctly :-(
  13. I find it very difficult to ad this to the script, i do not know where to begin, both the scripts are usable but i don't know how to implement it.
  14. Hi my script loads a CSV file, divides it in 6 coloms, and shows normally 30 items on the page. I programmed it so that for 1 row or product it has 6 items (from the csv). As you can see on www.dwmusicstore.com/mark/hollow3.php I made it now so it only shows 3 products. What i want is that it shows the 3 on the row, but after 3 it goes to the next row. Like this A B C D E F G H I because if i change the script that it shows 30 products, it puts the 30 products on 1 row. here is the script: <html> <head> </head> <body bgcolor=#E2E965 link=#E2E965 vlink=#E2E965 alink=#E2E965 text=#D5DF23> <style type="text/css"> body { scrollbar-arrow-color: #E2E965; scrollbar-face-color: #D7182A; scrollbar-highlight-color: #000000; scrollbar-3dlight-color: #D6DF23; scrollbar-shadow-color: #00000; scrollbar-darkshadow-color: #00000; scrollbar-track-color: #D6DF23; } input:link {text-decoration: none; color: #E2E965;} input:visited {text-decoration: none; color: #E2E965;} input:active {text-decoration: none; color: #E2E965;} .spacer_black { margin: 0px; padding: 0px; border: 5px; height: 2px; width: 100%; line-height: 0px; font-size: 0px; background-color: #000000;} </style> <table width=900> <tr> <td> </html> <?PHP $offset = isset($_GET['offset'])?$_GET['offset']:0; $LinesToDisplay = 3; $row = $offset + $LinesToDisplay; $row2 = $offset - $LinesToDisplay; $file_handle = fopen("web.txt", "rb"); error_reporting( E_ALL ); // DEBUGGING while ((($parts = fgetcsv($file_handle,4096,"|")) !== FALSE) && ($LinesToDisplay > 0) && (!feof($file_handle))) { //new code //skip first $offset lines $num = count($parts[5]); if ($parts[5] == 4010) { if ($offset-- > 0) {continue;} $parts[0] = ucwords(strtolower($parts[0])); $parts[1] = ucwords(strtolower($parts[1])); ?> <td> <?php echo "<p style='margin:9px;'><table BACKGROUND='background.jpg' border=0><td width='243' height='105'>"; echo "<font size=-1 face='helvetica' color=#812990><b>$parts[0]</b></font>"; echo "<i>"; ?> <html> <div onMouseOver="this.style.color = 'black';" onMouseOut="this.style.color = '#D5DF23';"></html><?php echo "<font size=2>-$parts[1]</font>"; echo "</div></i>"; ?> <TABLE BORDER='0' cellpadding='0' CELLSPACING='0'> <TR> <TD WIDTH='70' HEIGHT='20' BACKGROUND='pricebackground.jpg' VALIGN='bottom'> <center> <font size=2 color=white face='helvetica'> <b></html> <?php echo "€ $parts[2]"; ?> </b> </td> </tr> </table> <a href="#" title="Koop <?php echo $parts[0]; ?>" onClick="window.open('form.php?p=<?php echo urlencode($parts[0]); ?>','popuppage','width=400,height=400,top=250,left=250,resizable=0,statusbar=0,titlebar=yes,toolbar=no,scrollbars=no,location=no,directories=no');"> <div><img src='ster.jpg' border=0 width='50' align='right'></a> <?php echo "<b><font size=3 color=#D7182A>Op Voorraad In:<br></font>"; echo ("<font color=black> Amsterdam </font>"); if ( $parts[3] >= 1 ) echo ("<IMG SRC =green.gif>").""; if ( $parts[3] <= 0 ) echo ("<IMG SRC =red.gif>").""; echo ("<font color=black> Utrecht </font>"); if ( $parts[4] >= 1 ) echo ("<IMG SRC =green.gif>")."</td></table></b><p style='margin:9px;'>"; if ( $parts[4] <= 0 ) echo ("<IMG SRC =red.gif>")."</td></table></b><p style='margin:9px;'>"; $LinesToDisplay--; }} fclose($file_handle); ?> </tr></td></table> <html> <head> <body> <script language="Javascript"> <!-- if (document.images) { image1 = new Image image2 = new Image image1.src = 'vorige1.jpg' image2.src = 'vorige2.jpg' image3 = new Image image4 = new Image image3.src = 'volgende1.jpg' image4.src = 'volgende2.jpg' } --> </script> </head> </body> <center><a href="hollow.php?offset=<?php echo $row2;?>" onMouseOver="document.mouseover.src=image2.src" onMouseOut="document.mouseover.src=image1.src"><img src="vorige1.jpg" border=0 name="mouseover"></a> <a href="hollow.php?offset=<?php echo $row;?>" onMouseOver="document.mouseover2.src=image4.src" onMouseOut="document.mouseover2.src=image3.src"><img src="volgende1.jpg" border=0 name="mouseover2"></a> </center> </html>
  15. Hi, my scripts loads up a CSV file, and divide it in parts. Is it possible to sort these parts alphabetical ? As $parts[0] is the first to display, i want that row to be sorted, i have tried the sort command but it says that i need an array. Since the array is the whole $parts[0] i don't know how to use that command. Is there someone who knows how to do this ? <html> <head> </head> <body bgcolor=#E2E965 link=#E2E965 vlink=#E2E965 alink=#E2E965 text=#D5DF23> <style type="text/css"> body { scrollbar-arrow-color: #E2E965; scrollbar-face-color: #D7182A; scrollbar-highlight-color: #000000; scrollbar-3dlight-color: #D6DF23; scrollbar-shadow-color: #00000; scrollbar-darkshadow-color: #00000; scrollbar-track-color: #D6DF23; } input:link {text-decoration: none; color: #E2E965;} input:visited {text-decoration: none; color: #E2E965;} input:active {text-decoration: none; color: #E2E965;} .spacer_black { margin: 0px; padding: 0px; border: 5px; height: 2px; width: 100%; line-height: 0px; font-size: 0px; background-color: #000000;} </style> </html> <?PHP $offset = isset($_GET['offset'])?$_GET['offset']:0; $LinesToDisplay = 20; $row = $offset + $LinesToDisplay; $row2 = $offset - $LinesToDisplay; $file_handle = fopen("web.txt", "rb"); error_reporting( E_ALL ); // DEBUGGING while ((($parts = fgetcsv($file_handle,4096,"|")) !== FALSE) && ($LinesToDisplay > 0) && (!feof($file_handle))) { //new code //skip first $offset lines $num = count($parts[5]); if ($parts[5] == 9999) { if ($offset-- > 0) {continue;} $parts[0] = ucwords(strtolower($parts[0])); $parts[1] = ucwords(strtolower($parts[1])); echo "<p style='margin:9px;'><table BACKGROUND='background.jpg' border=0><td width='243' height='105'>"; echo "<font size=-1 face='helvetica' color=#812990><b>$parts[0]</b></font>"; echo "<i>"; ?> <html> <div onMouseOver="this.style.color = 'black';" onMouseOut="this.style.color = '#D5DF23';"></html><?php echo "<font size=2>-$parts[1]</font>"; echo "</div></i>"; ?> <TABLE BORDER='0' cellpadding='0' CELLSPACING='0'> <TR> <TD WIDTH='70' HEIGHT='20' BACKGROUND='pricebackground.jpg' VALIGN='bottom'> <center> <font size=2 color=white face='helvetica'> <b></html> <?php echo "€ $parts[2]"; ?> </b> </td> </tr> </table> <a href="#" title="Koop <?php echo $parts[0]; ?>" onClick="window.open('form.php?p=<?php echo urlencode($parts[0]); ?>','popuppage','width=400,height=400,top=250,left=250,resizable=0,statusbar=0,titlebar=yes,toolbar=no,scrollbars=no,location=no,directories=no');"> <div><img src='ster.jpg' border=0 width='50' align='right'></a> <?php echo "<b><font size=3 color=#D7182A>Op Voorraad In:<br></font>"; echo ("<font color=black> Amsterdam </font>"); if ( $parts[3] >= 1 ) echo ("<IMG SRC =green.gif>").""; if ( $parts[3] <= 0 ) echo ("<IMG SRC =red.gif>").""; echo ("<font color=black> Utrecht </font>"); if ( $parts[4] >= 1 ) echo ("<IMG SRC =green.gif>")."</td></table></b><p style='margin:9px;'>"; if ( $parts[4] <= 0 ) echo ("<IMG SRC =red.gif>")."</td></table></b><p style='margin:9px;'>"; $LinesToDisplay--; }} fclose($file_handle); ?> <html> <head> <body> <script language="Javascript"> <!-- if (document.images) { image1 = new Image image2 = new Image image1.src = 'vorige1.jpg' image2.src = 'vorige2.jpg' image3 = new Image image4 = new Image image3.src = 'volgende1.jpg' image4.src = 'volgende2.jpg' } --> </script> </head> </body> <center><a href="occasiona.php?offset=<?php echo $row2;?>" onMouseOver="document.mouseover.src=image2.src" onMouseOut="document.mouseover.src=image1.src"><img src="vorige1.jpg" border=0 name="mouseover"></a> <a href="occasiona.php?offset=<?php echo $row;?>" onMouseOver="document.mouseover2.src=image4.src" onMouseOut="document.mouseover2.src=image3.src"><img src="volgende1.jpg" border=0 name="mouseover2"></a> </center> </html>
  16. I have a script that loads up a CSV and than splits it into parts, these parts are called $parts[0] , $parts[1]...etc... In that script you see products, when you click on the shopping cart logo, it should copy the name of the product into the pop-up screen. On this server it does that: http://www.dwmusicstore.com/mark/2bas.php And on this server it doesn't: http://www.dirkwitte.nl/2bas.php These are exactly the same scripts, so why does it not work on one server and why does it on the other. Here is the 'parent' script <html> <head> </head> <body bgcolor=#E2E965 link=#E2E965 vlink=#E2E965 alink=#E2E965 text=#D5DF23> <style type="text/css"> body { scrollbar-arrow-color: #E2E965; scrollbar-face-color: #D7182A; scrollbar-highlight-color: #000000; scrollbar-3dlight-color: #D6DF23; scrollbar-shadow-color: #00000; scrollbar-darkshadow-color: #00000; scrollbar-track-color: #D6DF23; } input:link {text-decoration: none; color: #E2E965;} input:visited {text-decoration: none; color: #E2E965;} input:active {text-decoration: none; color: #E2E965;} .spacer_black { margin: 0px; padding: 0px; border: 5px; height: 2px; width: 100%; line-height: 0px; font-size: 0px; background-color: #000000;} </style> </html> <?PHP $offset = isset($_GET['offset'])?$_GET['offset']:0; $LinesToDisplay = 20; $row = $offset + $LinesToDisplay; $row2 = $offset - $LinesToDisplay; $file_handle = fopen("web.txt", "rb"); error_reporting( E_ALL ); // DEBUGGING while ((($parts = fgetcsv($file_handle,4096,"|")) !== FALSE) && ($LinesToDisplay > 0) && (!feof($file_handle))) { //new code //skip first $offset lines $num = count($parts[5]); if ($parts[5] == 3900) { if ($offset-- > 0) {continue;} $parts[0] = ucwords(strtolower($parts[0])); $parts[1] = ucwords(strtolower($parts[1])); echo "<p style='margin:9px;'><table BACKGROUND='background.jpg' border=0><td width='243' height='105'>"; echo "<font size=-1 face='helvetica' color=#812990><b>$parts[0]</b></font>"; echo "<i>"; ?> <html> <div onMouseOver="this.style.color = 'black';" onMouseOut="this.style.color = '#D5DF23';"></html><?php echo "-$parts[1]"; echo "</div></i>"; echo "<TABLE BORDER='0' cellpadding='0' CELLSPACING='0'><TR><TD WIDTH='70' HEIGHT='20' BACKGROUND='pricebackground.jpg' VALIGN='bottom'><center><font size=2 color=white face='helvetica'><b>€ ". $parts[2] ."</b></td></tr></table><a href='#' title='Koop $parts[0]' onClick=\"window.open('form.php?p=$parts[0]','popuppage', 'width=400,height=400,top=250,left=250, resizable=0, statusbar=0, titlebar=yes, toolbar=no, scrollbars=no, location=no, directories=no');\"><div><img src='ster.jpg' border=0 width='50' align='right'></a>"; echo "<b><font size=3 color=#D7182A>Op Voorraad In:<br></font>"; echo ("<font color=black> Amsterdam </font>"); if ( $parts[3] >= 1 ) echo ("<IMG SRC =green.gif>").""; if ( $parts[3] <= 0 ) echo ("<IMG SRC =red.gif>").""; echo ("<font color=black> Utrecht </font>"); if ( $parts[4] >= 1 ) echo ("<IMG SRC =green.gif>")."</td></table></b><p style='margin:9px;'>"; if ( $parts[4] <= 0 ) echo ("<IMG SRC =red.gif>")."</td></table></b><p style='margin:9px;'>"; $LinesToDisplay--; }} fclose($file_handle); ?> <html> <head> <body> <script language="Javascript"> <!-- if (document.images) { image1 = new Image image2 = new Image image1.src = 'vorige1.jpg' image2.src = 'vorige2.jpg' image3 = new Image image4 = new Image image3.src = 'volgende1.jpg' image4.src = 'volgende2.jpg' } --> </script> </head> </body> <center><a href="bas.php?offset=<?php echo $row2;?>" onMouseOver="document.mouseover.src=image2.src" onMouseOut="document.mouseover.src=image1.src"><img src="vorige1.jpg" border=0 name="mouseover"></a> <a href="bas.php?offset=<?php echo $row;?>" onMouseOver="document.mouseover2.src=image4.src" onMouseOut="document.mouseover2.src=image3.src"><img src="volgende1.jpg" border=0 name="mouseover2"></a> </center> </html> and here is the 'child' script: <HTML> <title>Bestel Formulier</title> <body bgcolor=#E2E965 link=#E2E965 vlink=#E2E965 alink=#E2E965> <font size=4 color=#D7182A><b><center>Bestel Formulier</b></center></font> <style type="text/css"> input:link {text-decoration: none; color: #E2E965;} input:visited {text-decoration: none; color: #E2E965;} input:active {text-decoration: none; color: #E2E965;} </style> <script type="text/javascript"><!--//--><![CDATA[//></script> <center> <font color="#E5C552" size=1> <TABLE cellSpacing=2 cellPadding=0 width=300 align=top> <TBODY> <TR> <FORM METHOD="post" ACTION="cgi-bin/mail-a-form.cgi"> <TD class=txtcatHead width=300 height=10><b><font color="black" size=1>Naam</TD> <TD width=300 height=10>* <INPUT TYPE="text" maxlength="50" size="30" NAME="realname"></td> <TR> <TD class=txtcatHead width=300 height=10><b><font color="black" size=1>Adres</TD> <TD width=300 height=10>* <INPUT TYPE="text" maxlength="50" size="30" NAME="Adres"></td> <TR> <TD class=txtcatHead width=300 height=10><b><font color="black" size=1>Postcode</TD> <TD width=300 height=10>* <INPUT TYPE="text" maxlength="50" size="30" NAME="Postcode"></td> <TR> <TD class=txtcatHead width=300 height=10><b><font color="black" size=1>Stad</TD> <TD width=300 height=10>* <INPUT TYPE="text" maxlength="50" size="30" NAME="Stad"></td> <TR> <TD class=txtcatHead width=300 height=10><b><font color="black" size=1>Land</TD> <TD width=300 height=10> <INPUT TYPE="text" maxlength="50" size="30" NAME="Land"></td> <TR> <TD class=txtcatHead width=300 height=10><b><font color="black" size=1>Produkt</TD> <TD width=300 height=10>* <input type="text" maxlength="50" size="30" name="Produkt" value="<?php echo isset($_POST['Produkt']) ? mysql_real_escape_string($_POST['Produkt']) : $p;?>"></td> <TR> <TD class=txtcatHead width=300 height=10><b><font color="black" size=1>E-mail Adres</TD> <TD width=300 height=10>* <INPUT TYPE="text" maxlength="50" size="30" NAME="email"></td> <INPUT TYPE="hidden" NAME="subject" VALUE="Bestelling"> <INPUT TYPE="hidden" NAME="missing_fields_redirect" VALUE="http://www.dirkwitte.nl/form2.php"> <INPUT TYPE="hidden" NAME="redirect" VALUE="http://www.dirkwitte.nl/form3.php"> <INPUT TYPE="hidden" NAME="recipient" VALUE="mark@dirkwitte.nl"> <INPUT TYPE="hidden" NAME="required" VALUE="email, Produkt, Adres, Postcode, Stad, realname"> <table> <i><h7><font color=black>Velden met een <b>*</b> zijn verplicht</h7></i></table> <table><BR><font color=black size=2><b>Eventuele opmerking bij de bestelling.</table> <Td class=txtcatHead width=300 height=10></td> <TD width=150 height=10> <TEXTAREA NAME="Vraag" ROWS="4" COLS="30"></TEXTAREA> <br><br> <button type="submit" VALUE="SEND" style="background:url(verstuur1.jpg);width:147px;height:27px;border:none;" onmouseover="this.style.background='url(verstuur2.jpg)';" onmouseout="this.style.background='url(verstuur1.jpg)';"></button> </FORM> </body> </html> As you can see on the second website, value P is not being copied into the form, how is this possible ? These scripts are the same, but on the top server it copies the value from the 'parent' script to the 'child' script and in the other it doesn't
  17. Damn, you're a lifesaver, it TOTALLY WORKS !!! Thank you, thank you, thank you
  18. I did some adjustments to the script but not the result i want. I am really getting headaches with this script. I am now getting the right page with the right entries. If i remove {continue;} from the script, and load it, than when i press NEXT, i get a blank page. When i place it back and run it and press NEXT it just shows the same 6 entries instead of going to the next 6, why is this ? what am i missing ? Here is the script again, can someone please help me ? <html> <head> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body bgcolor=#E2E965 link=#812990 vlink=#812990 alink=#812990 text=black> </html> <?PHP $offset = isset($_GET['offset'])?$_GET['offset']:0; $LinesToDisplay = 6; $row = $offset + $LinesToDisplay; $row2 = $offset - $LinesToDisplay; $file_handle = fopen("web.txt", "rb"); error_reporting( E_ALL ); // DEBUGGING while ((($parts = fgetcsv($file_handle,4096,"|")) !== FALSE) && ($LinesToDisplay > 0) && (!feof($file_handle))) { //new code //skip first $offset lines $num = count($parts[5]); if ($parts[5] == 5400) { if ($offset > 0) {continue;} $parts[0] = ucwords(strtolower($parts[0])); $parts[1] = ucwords(strtolower($parts[1])); echo "<p><a class='popup4' href='#'><font size=-1 face=Humanist777BT-ExtraBlackB><b>$parts[0]</b></font>"; echo "<table><tr><td><i>"; echo "<span class='comment'>$parts[1]</span></td></tr></table></i></a>"; echo "<TABLE BORDER='0' cellpadding='0' CELLSPACING='0'><TR><TD WIDTH='70' HEIGHT='20' BACKGROUND='pricebackground.jpg' VALIGN='bottom'><center><font color=white>€". $parts[2] ."</center></td></tr></table>"; echo "<b><font size=3 color=#D7182A>Op Voorraad In:<br></font>"; echo (" Amsterdam "); if ( $parts[3] >= 1 ) echo ("<IMG SRC =green.gif>").""; if ( $parts[3] == 0 ) echo ("<IMG SRC =red.gif>").""; echo (" Utrecht "); if ( $parts[4] >= 1 ) echo ("<IMG SRC =green.gif>")."<div class='spacer_black'></div></b>"; if ( $parts[4] == 0 ) echo ("<IMG SRC =red.gif>")."<div class='spacer_black'></div></b>"; $LinesToDisplay--; }} fclose($file_handle); ?> <html> <BR><a href="occasionb.php?offset=<?php echo $row2;?>">Previous</a> - <a href="occasionb.php?offset=<?php echo $row;?>">Next</a></html>
  19. I altered the script a little it seems to work but not the way i wanted. It shows now, nothing, and if i press next a couple of 50 times, it will find the right entry eventually and than shows it. So it only shows the items from the right colomn but only if you browse to all the columns first <html> <head> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body bgcolor=#E2E965 link=#812990 vlink=#812990 alink=#812990 text=black> </html> <?PHP $offset = isset($_GET['offset'])?$_GET['offset']:0; $LinesToDisplay = 6; $row = $offset + $LinesToDisplay; $row2 = $offset - $LinesToDisplay; $file_handle = fopen("web.txt", "rb"); while ((($parts = fgetcsv($file_handle,4096,"|")) !== FALSE) && ($LinesToDisplay > 0) && (!feof($file_handle))) { //new code //skip first $offset lines if ($offset-- > 0) { continue; } /////////////////////////// $num = count($parts[5]); if ($parts[5] == 5400) { $parts[0] = ucwords(strtolower($parts[0])); $parts[1] = ucwords(strtolower($parts[1])); echo "<p><a class='popup4' href='#'><font size=-1 face=Humanist777BT-ExtraBlackB><b>$parts[0]</b></font>"; echo "<table><tr><td><i>"; echo "<span class='comment'>$parts[1]</span></td></tr></table></i></a>"; echo "<TABLE BORDER='0' cellpadding='0' CELLSPACING='0'><TR><TD WIDTH='70' HEIGHT='20' BACKGROUND='pricebackground.jpg' VALIGN='bottom'><center><font color=white>€". $parts[2] ."</center></td></tr></table>"; echo "<b><font size=3 color=#D7182A>Op Voorraad In:<br></font>"; echo (" Amsterdam "); if ( $parts[3] >= 1 ) echo ("<IMG SRC =green.gif>").""; if ( $parts[3] == 0 ) echo ("<IMG SRC =red.gif>").""; echo (" Utrecht "); if ( $parts[4] >= 1 ) echo ("<IMG SRC =green.gif>")."<div class='spacer_black'></div></b>"; if ( $parts[4] == 0 ) echo ("<IMG SRC =red.gif>")."<div class='spacer_black'></div></b>"; } //new code //By here we decrement the line to display, when this reaches 0 the loop will stop $LinesToDisplay--; ////////////////////////////// } fclose($file_handle); ?> <html> <BR><a href="occasionb.php?offset=<?php echo $row2;?>">Previous</a> - <a href="occasionb.php?offset=<?php echo $row;?>">Next</a></html> If you want to see it in action. www.dwmusicstore.com/mark/occasionb.php and if you press next 40 times, here is the first entry http://www.dwmusicstore.com/mark/occasionb.php?offset=240 and here is the rest http://www.dwmusicstore.com/mark/occasionb.php?offset=288
  20. Hi, i am new here and i am working on this script trying to fine tune it. The problem is that i had this script for a while and thought it worked but it doesn't for the fully 100%. It reads it's data from a CSV, than it shows certain entries from that CSV, that works, but when i use the page numbering script in it, it page numbers everything from the CSV file and not certain entries. The part: if ( $parts[5] == 9999) is the part where it loads a certain piece of the CSV, a certain row. But it needs brackets, like this { If i remove those brackets the page (next) and (previous) works, but when i put it the brackets in, the next and previous button continuously show the same 6 products over and over again. How can i fix this ? What i want that the results from the if ( $parts[5] == 9999) is page numbered. Here is my script: <html> <head> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body bgcolor=#E2E965 link=#812990 vlink=#812990 alink=#812990 text=black> </html> <?PHP $offset = isset($_GET['offset'])?$_GET['offset']:0; $LinesToDisplay = 6; $row = $offset + $LinesToDisplay + $parts[5]; $row2 = $offset - $LinesToDisplay; $file_handle = fopen("web.txt", "rb"); while ((($parts = fgetcsv($file_handle,4096,"|")) !== FALSE) && ($LinesToDisplay > 0) && (!feof($file_handle))) { //new code //skip first $offset lines if ($offset-- > 0) { continue; } /////////////////////////// $num = count($parts[1]); if ( $parts[5] == 9999) $parts[0] = ucwords(strtolower($parts[0])); $parts[1] = ucwords(strtolower($parts[1])); echo "<p><a class='popup4' href='#'><font size=-1 face=Humanist777BT-ExtraBlackB><b>$parts[0]</b></font>"; echo "<table><tr><td><i>"; echo "<span class='comment'>$parts[1]</span></td></tr></table></i></a>"; echo "<TABLE BORDER='0' cellpadding='0' CELLSPACING='0'><TR><TD WIDTH='70' HEIGHT='20' BACKGROUND='pricebackground.jpg' VALIGN='bottom'><center><font color=white>€". $parts[2] ."</center></td></tr></table>"; echo "<b><font size=3 color=#D7182A>Op Voorraad In:<br></font>"; echo (" Amsterdam "); if ( $parts[3] >= 1 ) echo ("<IMG SRC =green.gif>").""; if ( $parts[3] == 0 ) echo ("<IMG SRC =red.gif>").""; echo (" Utrecht "); if ( $parts[4] >= 1 ) echo ("<IMG SRC =green.gif>")."<div class='spacer_black'></div></b>"; if ( $parts[4] == 0 ) echo ("<IMG SRC =red.gif>")."<div class='spacer_black'></div></b>"; //new code //By here we decrement the line to display, when this reaches 0 the loop will stop $LinesToDisplay--; ////////////////////////////// } fclose($file_handle); ?> <html> <BR><a href="occasion.php?offset=<?php echo $row2;?>">Previous</a> - <a href="occasion.php?offset=<?php echo $row;?>">Next</a></html>
×
×
  • 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.