marty.net 1001 Postcards Love Love Love Meep Meep ZenZodiac DailyQuotation

YOU ARE HERE:
How to embed cpshop in a PHP page

HOME

CPSHOP|

|

|

EMAIL MARTY
  marty.net message board
  « How to embed cpshop in a PHP page »
Welcome, Guest. Please Login or Register.
12/14/17 at 13:21:10
Home Help Search Login Register
   marty.net message board
   About cpshop
   Tutorials
   How to embed cpshop in a PHP page
(Moderator: Marty)
Pages: « 1 2 3 4 5 6 7 » Reply Notify of replies Send the topic Print 
   Author  Topic: How to embed cpshop in a PHP page  (Read 64375 times)
Marty
Administrator Dragon
*****

Gender: male
Posts: a whole lot



That's me. :)
   

WWW E-Mail
Re: How to embed cpshop in a PHP page
« Reply #75 on: 09/04/07 at 15:35:28 »
Reply with quote Modify message

Would I be correct In assuming your all working in *nix/Apache?

Most probably are.

anyone try this in windows/iis?

Not sure -- the same principals probably apply, though some changes to the include would likely be necessary.

Also earlier in the thread marty said <snip> ... why exactly would you not recomend that?  Cause I've already started doing it and am wondering if I should stop...

The main reason is that it meant starting over from scratch, parsing a page for content.  It's much easier to call a PHP template as a URL, allowing the PHP interpreter to do its dirty work first, and then pass the page as a template to cpshop.

It's doable, but it depends on your level of PHP ninjatude.

I wanted to add SEO links but since I'm on windows the cpshop option doesn't work so I found a PHP solution that parses your output html and replaces the default links with the permalinks that point at a separate page, then when the person links in, that page catches them and includes the page there asking for.. basically just what I was looking for so I'd like to not have to trash it... although performance may be an issue... not really sure yet..

Hey, if it works, it works.  Performance permitting, of course.

Also--  what exactly is that code you have there doing?  is it using the command line to execute the perl compiler(interpreter?) on the stores cgi files returning the output to $str and echoing it to the screen, or storing some special command that executes when echo'd?

Yup.

basically if you added a var_dump($str) and commented the echo would have all the html for the page in $str or just the string you stored there?

You'd have all the cpshop output at your disposal, yes.
Logged

--
Regards,
Marty·.¸¸.·´¯`·.¸¸.-> marty@marty.net
Redi_Jedi
Green Dragon
*

Posts: 5



Go Scots!
   

Re: How to embed cpshop in a PHP page
« Reply #76 on: 09/04/07 at 16:48:12 »
Reply with quote Modify message

humm.. well either I was doing something wrong or that doesn't work in IIS cause I had a blank string in $str, I had to use:

Code:
$qs = $HTTP_SERVER_VARS['QUERY_STRING'];

$filename = "http://test.nice-shirt.com/store/cpshop.pl?$qs";
$afile = fopen($filename, 'rb');
$content = "";
while (!feof($afile)) {
     $content .= fread($afile, 8192);
}
fclose($afile);


which seems to work fine pages load in like 2-3 seconds.. but thats with just me browsing, not sure how it will react under pressure... we'll see I guess... I'm almost done with the site so I'll prolly be replacing my main domain with it(currently cafescript) soon...
Logged
curmudgeony
Green Dragon
*

Posts: 9



Go Scots!
   

E-Mail
Re: How to embed cpshop in a PHP page
« Reply #77 on: 09/18/07 at 16:09:10 »
Reply with quote Modify message

I set up the code as it appeared in the 1st post, and the front page looks fine.  But when I click to a section heading, I'm also getting a case of

Content-Type: text/plain /phpindex.php The configuration file (phpindex.php.config) has not been generated. Please run cpadmin before proceeding.

Showing up.  Any ideas, or stuff I should post to help run down the problem?
Logged
ajay
Green Dragon
*

Posts: 4



Go Scots!
   

Re: How to embed cpshop in a PHP page
« Reply #78 on: 02/23/08 at 17:10:01 »
Reply with quote Modify message

Hi...
Parsing through the posts, I understand that some folks ran into this issue..


Content-Type: text/plain /index.php The configuration file (index.php.config) has not been generated. Please run cpadmin before proceeding.


I was wondering if anyone has solved the issue..

I am hosted on a shared linux host on godaddy.

Thanks in advance..

Ajay
Logged
ajay
Green Dragon
*

Posts: 4



Go Scots!
   

Re: How to embed cpshop in a PHP page
« Reply #79 on: 02/25/08 at 19:08:33 »
Reply with quote Modify message


A new error I get is..


Set-Cookie: cpshopcjpid=; path=/; Location: http://www.freedomexpressed.com/index.php


Any takers?
Thanks.
Logged
keeb
White Dragon
**

Posts: 20



Go Scots!
   

Re: How to embed cpshop in a PHP page
« Reply #80 on: 02/27/08 at 00:00:03 »
Reply with quote Modify message

I'm also getting the same error message:

Content-Type: text/plain /index.php The configuration file (index.php.config) has not been generated. Please run cpadmin before proceeding.

What do you say oh wise coding expert(s)?

Logged
Marty
Administrator Dragon
*****

Gender: male
Posts: a whole lot



That's me. :)
   

WWW E-Mail
Re: How to embed cpshop in a PHP page
« Reply #81 on: 02/28/08 at 03:01:09 »
Reply with quote Modify message

I've never been able to duplicate this problem, but I've heard it from several people.

If you email me the login info, I can try to route out the problem tomorrow.
Logged

--
Regards,
Marty·.¸¸.·´¯`·.¸¸.-> marty@marty.net
dreamingmonkey
Green Dragon
*

Posts: 5



Go Scots!
   

Re: How to embed cpshop in a PHP page
« Reply #82 on: 03/04/08 at 11:12:59 »
Reply with quote Modify message

I'm also hosting at GoDaddy (Linux Deluxe), and I have the same problem. I've determined that the problem is that $ENV{'QUERY_STRING'} isn't empty, and therefore the routine that parses the string contained within backticks isn't triggered. All this happens around line 1480 of cpdata.lib. Therefore ${script_dir}$main_script.config ends up pointing to a non-existent configuration file named for the PHP file (in my case index.php.config) and not cpshop.cgi.config.

I've worked out a couple potential solutions, but I haven't come up with one yet that doesn't involve hacking at the cpdata.lib file, which I hate to do because then any subsequent updates to that file will undo my hacks.

So far, the best I've come up with is adding a conditional routine that is triggered if @ARGV is populated and $ENV{'QUERY_STRING'} is also populated (unlike the original that checks for @ARGV to be populated and $ENV{'QUERY_STRING'} to be empty. I've had to re-work the parsing a little bit because part of the query string has nothing to do with CPShop, but rather the internal workings of my existing site. When I get something that's clean, I'll post it here. But I don't hold out much hope for being able to solve the problem without editing the cpdata.lib file, so hopefully when I do find a solution, Marty can find a way to make it part of future upgrades.
Logged
dreamingmonkey
Green Dragon
*

Posts: 5



Go Scots!
   

Re: How to embed cpshop in a PHP page
« Reply #83 on: 03/04/08 at 11:23:40 »
Reply with quote Modify message

Duh. Of course, you could always just add the following line to cpshop.cgi...

$ENV{'QUERY_STRING'} = '';

The problem I'm left with is that I have to somehow append data to the query string on links generated by the script that have nothing to do with CPShop. I haven't figured that out yet, but I just got my first look at the script about half an hour ago, so that's probably not a big deal.

Anyway, for those of you who are GoDaddy.com users or anyone else having that problem, the above line should solve your problems. To do it right, you should probably change

$hacked = 0;
to
$hacked = 1;

and put it within your if ($hacked) routine of cpshop.cgi, but that's housekeeping stuff and totally up to you.
Logged
thatjoshguy
Green Dragon
*

Gender: male
Posts: 5



yes, I am that josh guy.
   

WWW E-Mail
Re: How to embed cpshop in a PHP page
« Reply #84 on: 03/10/08 at 08:12:50 »
Reply with quote Modify message

nevermind...
« Last Edit: 03/10/08 at 08:32:57 by thatjoshguy » Logged
lostdeviant
Green Dragon
*

Posts: 4



¿que tal?
   

Re: How to embed cpshop in a PHP page
« Reply #85 on: 07/13/08 at 13:32:31 »
Reply with quote Modify message

What is the PHP code that would allow us to pull the sidebar <[sidebar]> info for integration into a CMS like WordPress, Joomla, etc.?

I'm using WordPress and just need to know how to do this to integrate the cpshop sidebar into my wordpress sidebar.

The steps mentioned earlier for including the code in PHP worked great except that I want to have the sidebar integrated too not just the content.

I started a separate thread so feel free to answer there too.
Logged
ajay
Green Dragon
*

Posts: 4



Go Scots!
   

Re: How to embed cpshop in a PHP page
« Reply #86 on: 12/18/08 at 11:53:52 »
Reply with quote Modify message

Content-Type: text/plain /index.php The configuration file (index.php.config) has not been generated. Please run cpadmin before proceeding.

I still keep getting the same message.

I have made the suggested changes to the CGI script, empied cache.. no use.

I cannot put up the maintenance pages either.

Thanks to anyone helping.
Ajay.
Logged
englishhaze
Green Dragon
*

Posts: 1



Go Scots!
   

Re: How to embed cpshop in a PHP page
« Reply #87 on: 01/08/09 at 11:04:14 »
Reply with quote Modify message

Miraculously, I managed to make this work first time! Except for one tiny glitch...

I get the 'Content-Type: text/html' displayed at the top of the page. I presume this is coming from the conditional statement in the cpshop.cgi file that tests for content in @ARGV.

Here is the code from the end of the cpshop.cgi file:


Code:
   unless (@ARGV) {
       print "Content-Type: text/html\n\n";
   }
   print $html;
   exit;


How can I get rid of this?

*edit* OK, I see that it is because I have nothing in my query string when I call the php page up. So it is doing exactly what it should be doing (@ARGV is empty) but I don't want that content-type text in my page so I commented out the conditional statement. Is this going to have consequences elsewhere?
« Last Edit: 01/08/09 at 11:56:47 by englishhaze » Logged
Robin_Brown
White Dragon
**

Posts: 23



I buy my scripts, thank you.
   

Re: How to embed cpshop in a PHP page
« Reply #88 on: 02/07/09 at 14:29:10 »
Reply with quote Modify message



on 01/08/09 at 11:04:14, englishhaze wrote:
Miraculously, I managed to make this work first time! Except for one tiny glitch...

I get the 'Content-Type: text/html' displayed at the top of the page. I presume this is coming from the conditional statement in the cpshop.cgi file that tests for content in @ARGV.

Here is the code from the end of the cpshop.cgi file:


Code:
   unless (@ARGV) {
       print "Content-Type: text/html\n\n";
   }
   print $html;
   exit;


How can I get rid of this?

*edit* OK, I see that it is because I have nothing in my query string when I call the php page up. So it is doing exactly what it should be doing (@ARGV is empty) but I don't want that content-type text in my page so I commented out the conditional statement. Is this going to have consequences elsewhere?

Okay, so it's just the home page of the store that is broken, since it has no query string. But I am a total failure at commenting out the right lines. When I try commenting out lines I break the script altogether.

What query string can I give as a fix for my store home page?
Logged
Marty
Administrator Dragon
*****

Gender: male
Posts: a whole lot



That's me. :)
   

WWW E-Mail
Re: How to embed cpshop in a PHP page
« Reply #89 on: 02/10/09 at 00:22:51 »
Reply with quote Modify message

I think I've actually rooted out the source of this particular bug...finally.  Try the latest update, and let me know if it works for you.
Logged

--
Regards,
Marty·.¸¸.·´¯`·.¸¸.-> marty@marty.net
Pages: « 1 2 3 4 5 6 7 » Reply Notify of replies Send the topic Print 
Jump to:


marty.net message board (http://www.marty.net/cgi/marty/board/messageboard)

Powered by YaBB 1 Gold - Release (Yet Another Bulletin Board)
Copyright © 2000-2001, X-Null. All Rights Reserved.