Webmastersite.net
Register Log In

importer.php problem

Title importer.php problem
Description - not adding all fields
Message Text I snagged the latest version of importer.php. When I use importer.php, it imports the links but doesn't pull in all fields. With the following importer.php file and importlinks.txt file, it correctly pulls in the URL, email, cat id, and link type. However, it won't pull in the Title, Description, or Recip URL for any of the links. In the importer.php config, I use a hard break for the $linksep. ########## begin importer.php ############ <?php require 'start.php'; // Flat file database import script for WSN Links // Place this file in the WSN Links directory /* Configure this section to your needs */ $filename = 'importlinks.txt'; // put the name of the database file here $linksep = ' '; // Please identify the unique character sequence which separates link entries in the file $fieldsep = '|'; // Please identify the unique character sequence which separates fields in each link $titleloc = '0'; // The number, counding from left to right starting at ZERO of the term where the link title appears within each link line $urlloc = '1'; // # of the term where the link URL appears within each link line $descriploc = '2'; // # of the term where the link description appears within each link line $votesloc = ''; // # of the term where the link's total number of votes appears within each link line $sumofvotesloc = ''; // # of the term where the link's total number of vote values appears within each link line $ratingloc = ''; // # of the term where the link rating appears within each link line $reciploc = '3'; // # of the term where the link reciprocal URL appears within each link line $hitsoutloc = ''; // # of the term where the link hits out appears within each link line $hitsinloc = ''; // # of the term where the link hits in appears within each link line $catidloc = '4'; // # of the term where the link's category id number appears within each link line $emailloc = '5'; // # of the term where the email address of the link submitter appears within each link line $typeloc = '6'; // # of the term where the link type of this link appears within each link line //$hardcodecategory = ''; // fill this in with a category id if you want to make all links be added to a particular category instead of specifying the category id for each link /* End configuration section */ $thefile = fileread($filename); $linkdata = explode($linksep, $thefile); $num = sizeof($linkdata); for ($x=0; $x<$num; $x++) { $linkline = explode($fieldsep, $linkdata[$x]); $thislink = new onelink('blank', 'blank'); $thislink->validated = 1; $thislink->hide = 'no'; $thislink->time = time(); if ($typeloc) $thislink->type = $linkline[$typeloc]; if (!$thislink->type) $thislink->type = 'regular'; if ($emailloc) $thislink->email = $linkline[$emailloc]; if ($titleloc) $thislink->title = $linkline[$titleloc]; if ($urlloc) $thislink->url = $linkline[$urlloc]; if ($hitsoutloc) $thislink->hits = $linkline[$hitsoutloc]; if ($hitsinloc) $thislink->hitsin = $linkline[$hitsinloc]; if ($ratingloc) $thislink->rating = $linkline[$ratingloc]; if ($votesloc) $thislink->votes = $linkline[$votesloc]; if ($sumofvotesloc) $thislink->sumofvotes = $linkline[$sumofvotesloc]; if ($recipurlloc) $thislink->recipurl = $linkline[$reciploc]; if ($descriptionloc) $thislink->description = $linkline[$descriploc]; if ($hardcodecategory) $thislink->catid = $hardcodecategory; else $thislink->catid = $linkline[$catidloc]; if ($thislink->catid < 1) die ("A bad category id (less than 1) was entered"); echo "Adding link <a href=". $thislink->url .">". $thislink->title ."</a> to category #". $thislink->catid ."... "; if (!(isduplicate($url, 'soft')) && ($settings->checkfordupdomain == 'no' || !(isduplicate($url, 'hard')))) $thislink->add(); } echo "<p>Done importing.</p>"; ?> ########### end importer.php ############# *********** begin importlinks.txt ********* Fred|http://www.yofred.com/|descrip of fred...|http://www.yofred.com/links.htm|4|fred@yofred.com|recip Ethel|http://www.yoethel.com/|descrip of ethel...||1|ethel@yoethel.com|regular ******** end importlinks.txt ************** Here's what I get in the browser when I call importer.php: Adding link to category #4... Adding link to category #1... A bad category id (less than 1) was entered Any idea what could be wrong? Many thanks for any thoughts smiling face
Rating
  • 0/5
  • 1
  • 2
  • 3
  • 4
  • 5
0/5 based on 0 votes.
Ownership scanreg
Views 880 views. Averaging 0 views per day.
Similar Topics
Submission Date Jun 08, 2006 - 9:50 AM