Results 1 to 2 of 2
  1. #1

    Default Add RSS feed reader on Newsletter Module

    I, i want do add on basic zen-cart newsletter module an option for adding the content of an rss instead of the html editor content.

    For reading rss something like this is working:

    // rss
    $insideitem = false;
    $tag = "";
    $title = "";
    $description = "";
    $link = "";

    function startElement($parser, $name, $attrs) {
    global $insideitem, $tag, $title, $description, $link;
    if ($insideitem) {
    $tag = $name;
    } elseif (strtolower($name) == "item") {
    $insideitem = true;
    }
    }

    function endElement($parser, $name) {
    global $insideitem, $tag, $title, $description, $link;
    if (strtolower($name) == "item") {
    printf("<li><strong><a href='%s' title='Read: %s' target='_blank'>%s</a></strong><br />",
    trim($link),trim($title),trim($title));
    printf("%s</li>",trim($description));
    $title = "";
    $description = "";
    $link = "";
    $insideitem = false;
    }
    }

    function characterData($parser, $data) {
    global $insideitem, $tag, $title, $description, $link;
    if ($insideitem) {
    switch (strtolower($tag)) {
    case "title":
    $title .= $data;
    break;
    case "description":
    $description .= $data;
    break;
    case "link":
    $link .= $data;
    break;
    }
    }
    }

    $xml_parser = xml_parser_create();
    xml_set_element_handler($xml_parser, "startElement", "endElement");
    xml_set_character_data_handler($xml_parser, "characterData");
    // feed url
    $fp = fopen("http://www.MYSITE.com/index.php?main_page=rss_feed&feed=new_products","r")
    or die("Error reading RSS data.");
    while ($data = fread($fp, 4096))
    xml_parse($xml_parser, $data, feof($fp))
    or die(sprintf("XML error: %s at line %d",
    xml_error_string(xml_get_error_code($xml_parser)),
    xml_get_current_line_number($xml_parser)));
    fclose($fp);
    xml_parser_free($xml_parser));

    // rss


    any help?
    Last edited by gamesmart; 2 Mar 2010 at 11:17 AM.

  2. #2

    Default Re: Add RSS feed reader on Newsletter Module

    No one is interested?

    My idea is to create a newsletter generator like the RSS option present on Mailchimp site.

 

 

Similar Threads

  1. Question about RSS feed add on
    By JohnBoyCR in forum All Other Contributions/Addons
    Replies: 4
    Last Post: 22 Nov 2009, 10:16 PM
  2. Rss Feed module help!!
    By cla74 in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 8 Apr 2009, 08:35 PM
  3. RSS help... do I need a reader?
    By ilovefilms in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 11 Nov 2008, 06:54 AM
  4. How to add RSS feed?
    By kevinmc3 in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 19 Aug 2008, 05:33 AM
  5. Anyone using the RSS Feed module?
    By kevinmc3 in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 11 Aug 2008, 07:20 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR