Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Need Help w/Smarty & Fetching

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 02-04-2003, 11:04 PM
 
ATKOgirl ATKOgirl is offline
 

X-Adept
  
Join Date: Sep 2002
Posts: 448
 

Default Need Help w/Smarty & Fetching

Hi,

I need to "fetch" my product descriptions from my suppliers web site. I found a script to do in with regular information, but does anyone know how to do it using the db and Smarty?

The script I have looks like this:

Code:
<?php $theLocation="http://www.site.com/bc/display.product.asp?product=0684837277"; $startingpoint = "Overview: </font>[/b]</td>"; $endingpoint = ""; // - "Don't touch this part..." preg_match("/^(https?:\/\/)?([^\/]*)(.*)/i", "$theLocation", $matches); $theDomain = "http://" . $matches[2]; $page = $matches[3]; $fd = fopen($theDomain.$page, "r"); // can change to "rb", on NT/2000 servers, if problems. $value = ""; while(!feof($fd)){ $value .= fread($fd, 4096); } fclose($fd); $start= strpos($value, "$startingpoint"); $finish= strpos($value, "$endingpoint"); $length= $finish-$start; $value=substr($value, $start, $length); // end "don't touch this part" $value = eregi_replace( "<IMG alt=[^>]*>", "", $value ); $value = eregi_replace( "<class[^>]*>", "", $value ); $value = eregi_replace( "<table[^>]*>", "", $value ); $value = eregi_replace( "<tr[^>]*>", "", $value ); $value = eregi_replace( "<td[^>]*>", "", $value ); $value = str_replace( "</font>", "", $value ); // Remove closing </font> tags. $value = str_replace( "</table>", "", $value ); // Remove closing </table> tags. $value = str_replace( "</tr>", "", $value ); // Remove closing </tr> tags. $value = str_replace( "</td>", "", $value ); // Remove closing </td> tags. $value = str_replace( "<center>", "", $value ); // Remove <center> tag... $value = str_replace( "</center>", "", $value ); // ...alignment calls. $value = str_replace( "", "", $value ); // Remove tags. $value = str_replace( "", "", $value ); // Remove closing tags... $value = str_replace( "Overview: [/b]", "", $value ); // Remove Overview:... $FinalOutput = preg_replace("/(href=\"?)(\/[^\"\/]+)/", "\\1" . $theDomain . "\\2", $value); echo $FinalOutput; //prints it to your page flush (); //force output to your page faster ?>

However, this is extremely slow and I have no clue how I would integrate it to work with x-cart and smarty. Any help is greatly appreciated.

ATKOgirl
__________________
X-Cart Versions: 4.1.10 and 4.2.0
Reply With Quote
  #2  
Old 02-06-2003, 11:07 PM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default

ATKOGirl, you'll need to learn Regular Expressions, as it seems the page is fetched, then the content is stripped, and spit out to where ever you want.

How I learned:
http://www.evolt.org/article/Regular_Expression_Basics/20/22700/index.html?format=print

__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 10:12 PM.

   

 
X-Cart forums © 2001-2020