If this is your first visit, check our documentation. To post, register or login.
Forums / Installing Zen Cart / Installing on a Windows Server / PHP code to study variables?

PHP code to study variables?

Started by lewisasding on 18 May 2013, 1:40 PM · Views: 2,667

Results 1 to 7 of 7
18 May 2013, 1:40 PM
#1
lewisasding avatar

lewisasding

New Zenner

Join Date:
Feb 2013
Posts:
17
Plugin Contributions:
0

Post #1 by lewisasding

Good afternoon everyone. May I ask for some help? I am slowly getting to understand the practical aspects of Zen Cart, but I would like to also be able to understand php coding. Over the years I have found that a combination of text books and practical examples is the best way forward in tackling the ‘steep curve’ for me. I would very much like to do the following:

Using a Local Host setup:

  1. Create a file (i.e. MyStore_variables) for storing variables.
  2. Construct a piece of code which I can embed into any ZC program of interest.
  3. Collect the contents of the variables in the program of interest, as the program runs.
  4. Store these variables into the file MyStore and save in the ZC file structure.

Is there anyone who could provide a solution? I do not want a full blown program just the basics and that in itself would help with php learning.

Back in BASIC days I could STOP, HALT or PAUSE a program and type in the variable name(s), which would then appear on the VDU or be sent to a printer.

Many thanks for any help.

18 May 2013, 3:00 PM
#2
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Post #2 by rodg

lewisasding:

Back in BASIC days I could STOP, HALT or PAUSE a program and type in the variable name(s), which would then appear on the VDU or be sent to a printer.

In places where you used to use STOP, etc, enter the following code.

require('dump.php'); // pretty variable dumps dump($var)
var_dump( get_defined_vars() );die();

Also, if you haven't yet discovered the joys of using a modern IDE I would strongly recommend you download one and learn how to use it. My preference is NetBeans, but there are several others that are equally good (and arguably better). Although these things may appear to have a lot of 'bloat' (especially for old time programmers, such as myself), and I still occasionally resort to 'hand coding' and using break commands to follow program flow, I think trying to code without a decent IDE these days is like riding a horse and buggy into town when everyone else is driving a car.

Cheers
Rod

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.

18 May 2013, 4:04 PM
#3
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,152
Plugin Contributions:
56

Post #3 by lat9

You could install the Super Globals Plus (http://www.zen-cart.com/downloads.php?do=file&id=524) plugin. It will display all the PHP variables you've configured via your admin for the current Zen Cart page.

18 May 2013, 4:27 PM
#4
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,767
Plugin Contributions:
56

Post #4 by swguy

Use PHPStorm. It's awesome. http://www.jetbrains.com/phpstorm/

If you're even moderately serious about this endeavor then, as @rodg says, this puts you in a car instead of a horse and buggy.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

19 May 2013, 9:40 AM
#5
lewisasding avatar

lewisasding

New Zenner

Join Date:
Feb 2013
Posts:
17
Plugin Contributions:
0

Post #5 by lewisasding

Thanks RodG for your help, support and code Very much appreciated; "die" in the context of this code is pretty scary the first time you use it.!!!

19 May 2013, 9:48 AM
#6
lewisasding avatar

lewisasding

New Zenner

Join Date:
Feb 2013
Posts:
17
Plugin Contributions:
0

Post #6 by lewisasding

lat9:

You could install the Super Globals Plus (http://www.zen-cart.com/downloads.php?do=file&id=524) plugin. It will display all the PHP variables you've configured via your admin for the current Zen Cart page.

Thanks Lat9 I will give it a go. I have only ever downloaded one other 'add-on' or 'plug-in’, sorry not sure of the difference.That was Dr.Byte's transfer of large sql files and that went well.

19 May 2013, 9:50 AM
#7
lewisasding avatar

lewisasding

New Zenner

Join Date:
Feb 2013
Posts:
17
Plugin Contributions:
0

Post #7 by lewisasding

SWGuy, thank you for your help and advice. Much appreciated.