Zen Cart Logo
Forums / General Questions / PHP inside ezpages

PHP inside ezpages

Views: 54,179

Results 21 to 40 of 114
1 Jun 2007, 8:18 PM
#21
jackrich1967 avatar

jackrich1967

New Zenner

Join Date:
May 2007
Posts:
11
Plugin Contributions:
0

PHP inside ezpages

I am a newbee, how do I

  1. edit the above pages to show different page names.
    I have changed page title and header, but dont know where to change the page names as they appear in the lefthand column sidebox on the main page.

  2. I seem to have lost icon.gif and put in in the wrong location(UK flag showing language as english) where does that image file go?

Somebody help please.

14 Jun 2007, 1:43 PM
#22
tecbrat avatar

tecbrat

Zen Follower

Join Date:
Feb 2005
Posts:
239
Plugin Contributions:
0

Re: PHP inside ezpages

jackrich1967:

I am a newbee, how do I

  1. edit the above pages to show different page names.
    I have changed page title and header, but dont know where to change the page names as they appear in the lefthand column sidebox on the main page.

  2. I seem to have lost icon.gif and put in in the wrong location(UK flag showing language as english) where does that image file go?

Somebody help please.

  1. Whatever you name the page on the ezpages view is the anchor text for the link to it in the menu. (I use the sidebox version)

  2. This really isn't an ezpages question, but the path you are asking for is /includes/languages/english/images/icon.gif Being in the US, I often replace the unionjack with the stars and stripes.

17 Jun 2007, 9:47 AM
#23
jackrich1967 avatar

jackrich1967

New Zenner

Join Date:
May 2007
Posts:
11
Plugin Contributions:
0

Re: PHP inside ezpages

Thanks for the advice. I sorted out the problems and catalogued it. Much appreciated.

jackrich1967

29 Jun 2007, 7:01 PM
#24
cfe avatar

cfe

New Zenner

Join Date:
Jun 2006
Posts:
86
Plugin Contributions:
0

Re: PHP inside ezpages

I've tried to use this code to implement a "Catalog Request" form in an ez-page that I created. The form handling and everything is done from within the ez-page. However, when the form is submitted, I simply get redirected back to the index page of my site, and the submit fails. I had a similar problem with another form I tried to create.

The form itself is pretty basic and I'm confident that the problem doesn't lie within the code itself. Any thoughts?

Thanks!

3 Jul 2007, 7:56 PM
#25
tecbrat avatar

tecbrat

Zen Follower

Join Date:
Feb 2005
Posts:
239
Plugin Contributions:
0

Re: PHP inside ezpages

I remember pulling my hair out trying to get a form to work inside infopages. (predecessor to ezpages). I'll take a look and see if I can remember how I did it.

3 Jul 2007, 8:21 PM
#26
tecbrat avatar

tecbrat

Zen Follower

Join Date:
Feb 2005
Posts:
239
Plugin Contributions:
0

Re: PHP inside ezpages

Okay,
inside my infopage is this line.

<? include( "/home/USERNAME/public_html/FORM_FILE_NAME.php" );?>

then inside my included file I have this

<?

$comments=stripslashes($comments);//needed during re-populate mode
if (!$formstatus=="submitted" || $frmerr=="retry"){
?>
<form method="POST" action="<? echo "$PHP_SELF"; ?>?main_page=infopages&pages_id=<? echo $pages_id;?>">
<input type=hidden name=formstatus value="submitted">

in my handler file (also included) I have this

if(!frmerr){ do whatever I need to do with this info}
else{
<form method="POST" action="<? echo "$PHP_SELF"; ?>?main_page=infopages&pages_id=<? echo $pages_id;?>">
<?
 foreach($_POST as $var => $val) {?>
<input type=hidden name=<? echo "$var";?> value="<?echo stripslashes($val);?>" >
<?}?>
<input type=hidden name=frmerr value="retry" >
<input type=submit value="Correct This">
</form>
...}

Obviously you'll have to take care of frmerr (Form error) yourself, and deal with re-populating the fields if you want to prevent someone from needing to retype all their info when they leave one required field blank.

You'll need to replace 'infopages' with 'page' and 'pages_id' with 'id'.

Code carefully, I may have introduced errors when removing personally identifiable information from my code.

12 Jul 2007, 7:29 PM
#27
gearstudios avatar

gearstudios

New Zenner

Join Date:
Sep 2005
Posts:
88
Plugin Contributions:
0

Re: PHP inside ezpages

This is a great tip. I will use it for sure.

Zen-Cart, The Greatest Shopping Cart!

10 Oct 2007, 6:37 PM
#28
rcrosier avatar

rcrosier

Zen Follower

Join Date:
Dec 2006
Location:
Vermont
Posts:
128
Plugin Contributions:
0

Re: PHP inside ezpages

Hi,

We want to be able to use PHP inside our "Main" page, under the "Define Pages Editor", so that when we copy our site to our "test" site, the links to special items change to match that.

What do we have to do, for instance, to change this link to PHP code in the "Main" page?:

http://vtstuff.com/index.php/vt-capital-tree-souvenirs-c-63.html

I want the ```html
http://vtstuff.com


Can anyone tell me what we need to do?

Thanks.

VTstuff.com, Quality gifts and products from Vermont.

11 Oct 2007, 3:11 PM
#29
rcrosier avatar

rcrosier

Zen Follower

Join Date:
Dec 2006
Location:
Vermont
Posts:
128
Plugin Contributions:
0

Re: PHP inside ezpages

OK, I got something to work to do this in the "Define Pages", but the same code won't work in the EZ Pages. That's OK for now, but it would be nice to be able to do it in an EZ Page

This is solely for the purpose of being able to COPY a site to a WORK area that has direct links to categories or products in the HTML code, so that the domain changes according to the site location.

Here's what I did to show the Product Info Page for an item:

<?php echo '<a href="' . zen_href_link(FILENAME_DEFAULT) . 'index.php/buttermilk-ranch-dressing-marinade-drews-p-441.html'. ' ">' . 'Click here to check out Drews Buttermilk Ranch Dressing & Marinade' . '</a>';?>

Just embed this code into the Define Pages page you're working on, chaning the item link and description sections to your item.

Make sure you enter this in TEXT mode.

Note, our site uses SEO URL's.

VTstuff.com, Quality gifts and products from Vermont.

11 Oct 2007, 4:20 PM
#30
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: PHP inside ezpages

If you want your "copy" to contain URLs that are "relative" to your install, regardless of where it is, just create relative links ... don't include the whole domain name ... make your links relative from the start, and you won't have to write custom code to fudge things around.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

12 Oct 2007, 12:45 PM
#31
rcrosier avatar

rcrosier

Zen Follower

Join Date:
Dec 2006
Location:
Vermont
Posts:
128
Plugin Contributions:
0

Re: PHP inside ezpages

DrByte:

If you want your "copy" to contain URLs that are "relative" to your install, regardless of where it is, just create relative links ... don't include the whole domain name ... make your links relative from the start, and you won't have to write custom code to fudge things around.

So I tried this for a link: ./index.php/buttermilk-ranch-dressing-marinade-drews-p-441.html

Thanks! That works nicely too. I hadn't thought of that. We'll do that. We can do that in the HTML too, so we don't need PHP, I think.

VTstuff.com, Quality gifts and products from Vermont.

8 Nov 2007, 11:01 PM
#32
kthompson avatar

kthompson

New Zenner

Join Date:
Jul 2007
Location:
Minneapolis, MN, United States
Posts:
71
Plugin Contributions:
0

Re: PHP inside ezpages

What are the security issues with this method?

Thanks

I dont care what it says next to my name. I've been Zenned!

10 Nov 2008, 12:04 AM
#33
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: PHP inside ezpages

KThompson:

What are the security issues with this method?

Thanks
Allowing people to input whatever code and the run it is asking for trouble.

Personally, I believe the the define pages should not allow users to put php codes in from admin side as well.

I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

11 Nov 2008, 9:35 PM
#34
tecbrat avatar

tecbrat

Zen Follower

Join Date:
Feb 2005
Posts:
239
Plugin Contributions:
0

Re: PHP inside ezpages

yellow1912:

Allowing people to input whatever code and the run it is asking for trouble.

Personally, I believe the the define pages should not allow users to put php codes in from admin side as well.

When I created this topic, I was thinking of people like me that are both the coder, and the maintainer of the cart, so the only "people" I am allowing anything is me.

Certainly if you are allowing end-users to edit their ezpages, you don't want them messing around with php. You could require a passcode to be present in the file before the php is executed, but if the end user is savvy, they could dig that out of one of your existing files. There is probably a solution though, if someone puts enough thought into it.

edit:
You could hard code page ids into the script so that only certain pages were allowed to execute php. Then whenever you made a new page, you could update the script. You have to educate your clients not to mess with existing pages and let them know that if they break it, they'll pay by the hour (Read "through the nose" ) to have it fixed.

11 Nov 2008, 10:19 PM
#35
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: PHP inside ezpages

I just give a warning to people who want to use this work-around.
Ultimately, it is up to the owner of the store to decide that if the benefit is worth the risk.
Also, if you let people login to the store admin to do the updates, make sure you limit access to define page editor (and in this case, ezpage editor).

I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

18 Nov 2008, 3:05 PM
#36
jerry5763837 avatar

jerry5763837

Zen Follower

Join Date:
May 2008
Posts:
261
Plugin Contributions:
0

Re: PHP inside ezpages

HI, yellow,

These days, i came across another problem about filename.php

In order to create exchange links with my partners, they request me to create a filename.php page, into which will put code.

So is it possible to create a new page named filename.php??

Any suggesetion would be highly appreciated. thanks.

11 Aug 2009, 2:59 PM
#37
tecbrat avatar

tecbrat

Zen Follower

Join Date:
Feb 2005
Posts:
239
Plugin Contributions:
0

Re: PHP inside ezpages

I received a PM about this thread where the user was trying to use this method with tinymce running. Remember to use SRC mode with any HTML editor you might be using to avoid errors.

The user reported that switching to src mode resolved his/her problems.

Corry.
aka TecBrat.

31 Aug 2009, 10:44 AM
#38
bonnit avatar

bonnit

Zen Follower

Join Date:
Jun 2009
Location:
Kent, UK
Posts:
350
Plugin Contributions:
0

Re: PHP inside ezpages

hehe i was the one that PM'd you, thanks so much for the help!!

although i do have one more question, now that im using the src mode of the wysiwyg i have noticed that one i have put content in, say normal html and also a php include or something, if i save and then go back at a later date the php is missing from the page and if i make any changes the php is removed as if it was never there. if i make no changes then of course the page remains the same.... this is very annoyiing, is this a problem with the editor or is this zen cart?

http://www.mods.livvylougifts.co.uk Zen Cart Mod Site
http://www.livvylougifts.co.uk Personalised gifts for every occasion

31 Aug 2009, 11:24 AM
#39
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: PHP inside ezpages

That's the editor -- it's getting rid of stuff it doesn't recognize as valid HTML.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

31 Aug 2009, 11:28 AM
#40
bonnit avatar

bonnit

Zen Follower

Join Date:
Jun 2009
Location:
Kent, UK
Posts:
350
Plugin Contributions:
0

Re: PHP inside ezpages

ive found the solution, it is due to the fckeditor not zen cart, apparent it is by default set to not allow full page edits and also has the ability to recogise and display php commented out. the solution which i found on this site by Jason Whitener

Go into your editors folder, go into fckeditor directory and open fckconfig.js for editing, find the following:

FCKConfig.FullPage = false;

and change it to

FCKConfig.FullPage = true;

finally to allow the php to show up too search for

// FCKConfig.ProtectedSource.Add( /<\?[\s\S]*?\?>/g ) ; // PHP style server side code

and uncomment by removing the two slashes at the begining of the line. re-upload this file and all should display fine

http://www.mods.livvylougifts.co.uk Zen Cart Mod Site
http://www.livvylougifts.co.uk Personalised gifts for every occasion