Results 1 to 8 of 8
  1. #1
    Join Date
    Jul 2006
    Posts
    8
    Plugin Contributions
    0

    Default Understanding the Code

    Ok. I’ve just got this software and am a bit like everyone else. Frustrated with all the coding and the work needed to customize your page. My problem is that I never worked with PHP. So it’s like me flying over to China and not knowing how to speak Chinese. Yeah. Well going through the forums I see people asking for help and a lot of the times they just get sent to another page. And the page that tells you how to make a new template tells you simply how to make a stupid folder to start your template. And a little CSS helper with changing colors and crap. And saying well find the page you want to edit and go from there. Well you don’t really say how to edit the page. Anyways make a webpage is easy enough but when you are reading this php code included it’s confusing so this is a my newbie understanding of some of the code possibly to help others gain an understanding. I believe this is all correct and I believe it’s best to understand how something works before just jumping in and playing around. Noting I used the developers tool kit to search for the definitions and putting my own knowledge to this. This is a portion of the tpl_header.php and a stab at understanding it.

    <div id="navMain">
    <ul class="back">
    <li><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'; ?><?php echo HEADER_TITLE_CATALOG; ?></a></li>

    HTTP_SERVER is my domain name www.mydomain.com and is located in public_html/shoppingcart/includes/configure.php

    DIR_WS_CATALOG is the shopping cart location http://www.mydomain.com/shoppingcart and is located in public_html/shoppingcart/includes/configure.php

    HEADER_TITLE_CATALOG is the text “Home” and is located in
    public_html/shoppingcart/includes/languages/english/header.php
    (note this is where it defines the text home go here to change)


    <?php if ($_SESSION['customer_id']) { ?>
    <li><a href="<?php echo zen_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>"><?php echo HEADER_TITLE_LOGOFF; ?></a></li>
    <li><a href="<?php echo zen_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a></li>
    <?php
    } else {
    if (STORE_STATUS == '0') {
    ?>
    <li><a href="<?php echo zen_href_link(FILENAME_LOGIN, '', 'SSL'); ?>"><?php echo HEADER_TITLE_LOGIN; ?></a></li>
    <?php } } ?>

    FILENAME_LOGOFF is the command “Logoff” which entails a command to logoff when a customer is logged in. The IF implies these statements occur when the customer is logged in. This is defined in /public_html/shoppingcart/includes/filenames.php

    HEADER_TITLE_LOGOFF is the text “Log out” defined in /public_html/shoppingcart/includes/languages/english/header.php

    FILENAME_ACCOUNT is defined as “account” sending this command. It is located in
    public_html/shoppingcart/includes/filenames.php

    HEADER_TITLE_MY_ACCOUNT is the text “My Account” defined in public_html/shoppingcart/includes/languages/english/header.php

    Now this is an if…else.. statement <?php if ?> <?php }else { which implies that if a user is logged in then these statements will be available for execution whereas if not logged in these statements are ignored.. Simple way to understand.. Login to an account. Notice how Log Out and My Account now show up on your pages. Log Off and they are no longer there =P


    FILENAME_LOGIN is also the command to Login or goto the login page to login which is also defined in /public_html/shoppingcart/includes/filenames.php
    (note that when a user logs in it sends the command post filename_login to send the command to login)

    HEADER_TITLE_LOGIN is the text “Log In” defined in public_html/shoppingcart/includes/languages/english/header.php


    <?php if ($_SESSION['cart']->count_contents() != 0) { ?>
    <li><a href="<?php echo zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'); ?>"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a></li>
    <li><a href="<?php echo zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>"><?php echo HEADER_TITLE_CHECKOUT; ?></a></li>
    <?php }?>
    </ul>
    </div>
    <div class="navMainSearch forward"><?php require(DIR_WS_MODULES . 'sideboxes/search_header.php'); ?></div>
    <br class="clearBoth" />
    </div>

    FILENAME_SHOPPING_CART is for the command “shopping_cart” to send you to the shopping cart. This is defined in
    public_html/shoppingcart/includes/filenames.php

  2. #2
    Join Date
    Aug 2004
    Posts
    1,590
    Plugin Contributions
    1

    Default Re: Understanding the Code

    Most of these technical questions / solutions are already mentionned from the wiki documentation of this site. You can easily seek for the answers from that huge manual, by using the wiki's search engine, as results will be detailedly returned to you on how to operate these codes (may be not all of them but most of them).

  3. #3
    Join Date
    Jun 2003
    Posts
    33,715
    Plugin Contributions
    0

    Default Re: Understanding the Code

    Looks like you have understood - Do you have a question?

  4. #4
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    9,107
    Plugin Contributions
    11

    Default Re: Understanding the Code

    I realize that you are trying to be helpful but, just as there is more than one door on a house, there are many ways to "get ZenCart going."

    Some of your directory examples will not work for those on different operating systems. And, most of the items in the tpl_header are set at installation. If not, they are configured through the admin.

    I'm not sure that most who come to the forum for help are ready to enter the house through the second floor window. No, I'm not calling you a "second-story man." Just pointing out that you may be trying to start from the inside and work out versus build the foundation and go from there to the "second floor" of code manipulation. Especially if you are, as you say, not familiar with PHP. Good news is that you really don't have to be.

    When helping someone use a software or program, I always tell them to take the time to look at the menu bar at the top. The same should be done on a newly installed ZenCart. Time will be better spent if the installer dives into the admin control panel and goes item by item through the list.

    When (notice I didn't say if ) the need arises to change items you have listed, the user would best be suited to use the Developer's Tool Kit in the Admin under tools.

    Using a simple text editor, they would know which file and what words to change.

    Since this is your first post, is there something you need answered?

    TO THE DEVS - One thing on my mind for some time is that most cannot see the docs when first loading ZenCart. How's about a two-option addition to the ZC_Install homepage giving options to install or read the docs. Easier than noobies having to "stumble across" mycart.com/docs.

  5. #5
    Join Date
    Jun 2003
    Posts
    33,715
    Plugin Contributions
    0

    Default Re: Understanding the Code

    DblToe-

    There are links on the install success page to the Docs, the forum and the FAQs.

    Unfortunately, you can lead the horse to water, but can not make him drink.

  6. #6
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    9,107
    Plugin Contributions
    11

    Default Re: Understanding the Code

    OR... You can lead a horse to water but, you can't make 'em pull the bird out of the bush.

    Most are so delighted at having installation success that they don't see the docs, form, etc.

    I think some would appreciate the opportunity to read before they leap.

    JMHO

  7. #7
    Join Date
    Jun 2003
    Posts
    33,715
    Plugin Contributions
    0

    Default Re: Understanding the Code

    We have given serious thought to making a "next" button for the install success that goes directly to the /docs/ index instead of having buttons to the catalog and admin ...

  8. #8
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    9,107
    Plugin Contributions
    11

    Default Re: Understanding the Code

    Guess I'm a strange duck. All my installation guides are out of the shrink wrap.

 

 

Similar Threads

  1. Understanding the confusing install Docs
    By odyssey999 in forum Installing on a Linux/Unix Server
    Replies: 4
    Last Post: 8 Jul 2009, 06:00 PM
  2. Understanding the login process
    By cdunbar in forum General Questions
    Replies: 2
    Last Post: 3 Sep 2008, 06:38 PM
  3. Understanding the hit counter
    By dssprogrammer in forum General Questions
    Replies: 2
    Last Post: 15 Jul 2007, 09:40 AM
  4. Understanding the SaleMaker Rules
    By wickedklown in forum Setting Up Specials and SaleMaker
    Replies: 4
    Last Post: 2 Nov 2006, 07:41 AM
  5. Understanding the stylesheet.
    By blessed in forum Templates, Stylesheets, Page Layout
    Replies: 9
    Last Post: 3 Jul 2006, 06:29 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