Welcome to Geeklog, Anonymous Tuesday, November 26 2024 @ 05:11 am EST

Geeklog Forums

CafePress script for GL

Page navigation


Status: offline

newblogger

Forum User
Regular Poster
Registered: 08/22/04
Posts: 107
Location:Virginia Beach
Banging your head

Whenever I add the before mentioned function to my lib-common.php i lose my site, basically every page just turns white with no info. Also when attempting to add just the store.php to my public_html directory, changing just the store name i get the store.php coming up as just a white page also. no products or page blocks for that matter. any help would be greatly appreciated.
Got Hot wheels? http://www.dcmotoring.com
 Quote

Status: offline

ScurvyDawg

Forum User
Full Member
Registered: 11/06/02
Posts: 523
If you change the name of the script you have to change the references to store.php to whatever you named it in the store.php file, otherwise you get a blank page.

In regard to adding something to lib-common I do not see anyone who said to do so. Read the instructions again maybe you mean lib-custom??
 Quote

Status: offline

newblogger

Forum User
Regular Poster
Registered: 08/22/04
Posts: 107
Location:Virginia Beach
i didn't change the name of the store.php i meant in the file store.php i changed it to my store 'virginia_slims' and i mistyped it is lib-custom.php i was changing, but like i said same results nothing is showing up
Got Hot wheels? http://www.dcmotoring.com
 Quote

Status: offline

newblogger

Forum User
Regular Poster
Registered: 08/22/04
Posts: 107
Location:Virginia Beach
thank you for your help scurvy. the store.php is working finally. On to the other part of my original post, whenever i include the code for the random shop into my lib-custom.php, i get nothing but a white page for my entire site. any help on this matter?
Got Hot wheels? http://www.dcmotoring.com
 Quote

Status: offline

ScurvyDawg

Forum User
Full Member
Registered: 11/06/02
Posts: 523
Post your code for review here and be sure to use the CODE button in the forum so it is displayed correctly and not filtered out.

 Quote

Status: offline

newblogger

Forum User
Regular Poster
Registered: 08/22/04
Posts: 107
Location:Virginia Beach
Ok thanks everyone for all your help sorry it has taken so long for me to get back, it has been a very tiring week. Posted below is an excerpt from my lib-custom.php that is not working. it has the last two entries working. daily dilbert, and then the rand_shop which is not. please advise. you can see my page here as of right now i do not have the rand_shop code in my lib-custom as it cause my page to go blank. This is the version i replace my current lib-custom with, that causes the error. Ok here goes.
Text Formatted Code
*/
/* Geeklog Block to retrieve the Daily Dilbert Comic
* Created by Blaine Lang
*  Jan 13 2005
*  www.portalparts.com
*/
function phpblock_dailydilbert() {
    global $_CONF;

    /* Create a unique name for the Daily Dilbert comic file */
    $dilbert_todayfile = 'images/comics/dilbert'. date('Ymd') . '.gif';
    $file = "{$_CONF['path_html']}$dilbert_todayfile";

    /* Check if today's Dilbert comic already exists - if not retrieve it and create the image */
    if (!file_exists($file)) {

        /* Setup the Web Service Client */
        include ($_CONF['path_system'] .'nusoap.php');
        $wsdl = "http://www.esynaps.com/WebServices/DailyDilbert.asmx?WSDL";
        $client = new soapclient( $wsdl,"true");

        /* Call the Web Service and decode the base64 contents back to a GIF file */
        $image = base64_decode($client->call('DailyDilbertImage', ''));

        /* Now write the raw image and create the image file */
        $fp = fopen("{$_CONF['path_html']}$dilbert_todayfile",'w');
        fwrite($fp,$image);
        fclose($fp);
    }

    $imageurl = "{$_CONF['site_url']}/$dilbert_todayfile";

    return ("<a href=\"$imageurl\"><img src=\"$imageurl\" width=\"180\" border=\"0\"></a>");
}

function phpblock_randshop() {
global $_CONF;

// SET VARIABLES //
srand ((float) microtime() * 10000000);
$start = '<!-- ### Items ### -->';
$end = '<!-- ### end of ITEMS ### -->';
$stores = 'virginia_slims';
$url = 'http://www.cafepress.com/' . $stores;
$itemfile = '/system/cpitemfile.inc';
$mode = $_SERVER['QUERY_STRING'];

if ($mode == "update") {
    echo "Beginning CP item file update...<br>n";

    // connect to CP
    $reqheader = "GET /$stores HTTP/1.0rnHost: www.cafepress.comrnUser-Agent: MS Internet Explorerrnrn";
    $socket = @fsockopen("www.cafepress.com", 80, &$errno, &$errstr);
    if ($socket)
    {
        fputs($socket, $reqheader);
        while (!feof($socket))
        {
            $cpfile .= fgets($socket, 4096);
        }
    }
    fclose($socket);


    $items = eregi("$start(.*)$end", $cpfile, $cparray);

    $newcparray = split ("n", $cparray[1]);

    foreach ($newcparray as $line) {
    if (strlen($line) > 100)
        {
        $newestcparray[] = $line;
        }
    }

    $handle = fopen($itemfile, "w");
    foreach ($newestcparray as $line) {
    $line = ereg_replace("<td align="center" valign="top"><p>","",$line);
    $line = ereg_replace("</td>","",$line);
    $line = ereg_replace("150","100",$line);
    $line = ereg_replace("<b>(.*)</b>","",$line);
//  $line = ereg_replace("\$(.*)r", "r", $line);  // Uncomment to hide prices
    if (eregi("<td colspan=3>",$line)) {unset ($line);}
    if (eregi("<tr>",$line)) {unset ($line);}
    $line = ereg_replace("<a href="","<a href="http://www.whatmenwant.net/store.php?target=http://www.cafepress.com",$line);
    $line = ereg_replace("src="/cp/img","src="http://www.cafepress.com/cp/img",$line);
    if (!empty($line)) {
        $lastcparray[] = $line;
        fwrite($handle, $line);
        }
    }
    fclose($handle);
    echo "CP item file update completed.n";
}
else {
    $itemhandle = fopen($itemfile, "r");
    $itemarray = fread($itemhandle,filesize("$itemfile"));
    fclose($itemhandle);
    $lastcparray = split ("r", $itemarray);

    $item = $lastcparray[rand(0,count($lastcparray)-2)];
    $item = ereg_replace("[x27]",'',$item);
    $item = trim($item);
   //for javascript use:
    //echo "document.write('<div align="center">" . $item . "</div>');";

    //for php use:
    $theitem = '<div align="center">' . $item . '';
    $theitem .= '<a href="' . $_CONF['site_url'] . '/store.php"><strong>More Products</strong></a></div>';
    return $theitem;
    }
}
?>

 


Got Hot wheels? http://www.dcmotoring.com
 Quote

Status: offline

newblogger

Forum User
Regular Poster
Registered: 08/22/04
Posts: 107
Location:Virginia Beach
been a week and no answer, i guess i'll have to give up on this one.
Got Hot wheels? http://www.dcmotoring.com
 Quote

Status: offline

jetshack

Forum User
Full Member
Registered: 06/29/04
Posts: 122
Location:Texas
very neat...

I've got no real use for it, but might come in handy later, who knows!

regardless... quick and easy setup and worked right out of the er... box?
 Quote

Page navigation

All times are EST. The time is now 05:11 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content