Thread: PHP Addressing

Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    Nov 2009
    Location
    Aransas Pass, TX
    Posts
    101
    Plugin Contributions
    1

    Default PHP Addressing

    I am getting to where I can man-handle ZenCart, but I need to get more familiar with php and have found a couple of decent primers. In the mean time, I need to jump the gun and trying to find the answer gets me a lot of close calls, but not what I am looking for.

    I want to change this --->

    <a href="http://67.222.96.12/~technomo/index.php?main_page=page&id=1" target="_self">

    into this --->

    <a href="HTTP_SERVER/index.php?main_page=page&id=1" target="_self">

    I tried the search and got as many results as pages in the php primer. Though I know I will need to finish the book, I would really like this answer now.

    Thanks

    ZenCart 1.3.8
    PHP 5.2.6
    MySQL 5.0.67
    Glacial Age Template
    Editable_Sidebox_1.0 <--- This is where I need the mod

  2. #2
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: PHP Addressing

    I understand *what* you're asking, but am wondering *why* you're asking it.

    Is there a particular reason why you're quoting an IP address?
    Is there a particular reason why you're using absolute URLs instead of relative URLs?
    .

    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.

  3. #3
    Join Date
    Nov 2005
    Location
    Colorado Springs, CO USA
    Posts
    7,033
    Plugin Contributions
    31

    Default Re: PHP Addressing

    Quote Originally Posted by IATIA View Post
    I am getting to where I can man-handle ZenCart, but I need to get more familiar with php and have found a couple of decent primers. In the mean time, I need to jump the gun and trying to find the answer gets me a lot of close calls, but not what I am looking for.

    I want to change this --->

    <a href="http://67.222.96.12/~technomo/index.php?main_page=page&id=1" target="_self">

    into this --->

    <a href="HTTP_SERVER/index.php?main_page=page&id=1" target="_self">

    I tried the search and got as many results as pages in the php primer. Though I know I will need to finish the book, I would really like this answer now.

    Thanks

    ZenCart 1.3.8
    PHP 5.2.6
    MySQL 5.0.67
    Glacial Age Template
    Editable_Sidebox_1.0 <--- This is where I need the mod
    if you using this in zen cart then this should produce the desired result:

    <?php echo '<a href="' . zen_ez_pages_link(1) . '" target="self">'; ?>

  4. #4
    Join Date
    Nov 2009
    Location
    Aransas Pass, TX
    Posts
    101
    Plugin Contributions
    1

    Default Re: PHP Addressing

    Quote Originally Posted by DrByte View Post
    I understand *what* you're asking, but am wondering *why* you're asking it.

    Is there a particular reason why you're quoting an IP address?
    Is there a particular reason why you're using absolute URLs instead of relative URLs?
    Apparently because I do not know what I am doing! Ergo, "man-handling" ZenCart.

    This is for my sideboxes @ TechnoMonkeys

  5. #5
    Join Date
    Nov 2009
    Location
    Aransas Pass, TX
    Posts
    101
    Plugin Contributions
    1

    Default Re: PHP Addressing

    Quote Originally Posted by clydejones View Post
    if you using this in zen cart then this should produce the desired result:

    <?php echo '<a href="' . zen_ez_pages_link(1) . '" target="self">'; ?>
    Thanks, I will try it out.

  6. #6
    Join Date
    Nov 2009
    Location
    Aransas Pass, TX
    Posts
    101
    Plugin Contributions
    1

    Default Re: PHP Addressing

    Quote Originally Posted by DrByte View Post
    I understand *what* you're asking, but am wondering *why* you're asking it.

    Is there a particular reason why you're quoting an IP address?
    Is there a particular reason why you're using absolute URLs instead of relative URLs?
    My goal is to make it fully relocateable. Change the configure.php file and everything is relocated.

    Any help cleaninig up define_amazon_1_content would be greatly appeciated. I want to be able to work on my site locally rather than live. (I have killed my store several times. Not a good thing.)

    amazon_1_defines
    <?php
    define('BOX_HEADING_AMAZON_1', '');
    define('DEFINE_AMAZON_1_NAME', 'define_amazon_1_content');
    ?>

    amazon_1
    <?php
    $define_sidebox = zen_get_file_directory(DIR_WS_LANGUAGES . $_SESSION['language'] . '/html_includes/', DEFINE_AMAZON_1_NAME, 'false');

    if (isset($ezpage_id) && in_array($ezpage_id,explode(",",'1'))) {

    require($template->get_template_dir('tpl_amazon.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_amazon.php');
    $title = BOX_HEADING_AMAZON_1;
    $title_link = false;
    require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
    }
    ?>

    tpl_amazon
    <?php
    $content = '';
    $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">';
    $content .= file_get_contents($define_sidebox);
    $content .= '</div>';
    ?>

    define_amazon_1_content
    <li style="margin-left:20px;"><a href="http://67.222.96.12/~technomo/index.php?main_page=page&id=1" target="_self"><b>Cameras & Accessories</b></a></li>
    <li style="margin-left:30px;"><a href="http://astore.amazon.com/techno_photography-20?_encoding=UTF8&node=32" target="iframe">Accessories</a></li>
    <li style="margin-left:30px;"><a href="http://astore.amazon.com/techno_photography-20?_encoding=UTF8&node=33" target="iframe">Binoculars, Telescopes & Optics</a></li>
    <li style="margin-left:30px;"><a href="http://astore.amazon.com/techno_photography-20?_encoding=UTF8&node=34" target="iframe">Camcorders</a></li>
    <li style="margin-left:30px;"><a href="http://astore.amazon.com/techno_photography-20?_encoding=UTF8&node=35" target="iframe">Cases & Bags</a></li>
    <li style="margin-left:30px;"><a href="http://astore.amazon.com/techno_photography-20?_encoding=UTF8&node=36" target="iframe">Digital Photo Frames</a></li>
    <li style="margin-left:30px;"><a href="http://astore.amazon.com/techno_photography-20?_encoding=UTF8&node=37" target="iframe">Digital SLRs</a></li>
    <li style="margin-left:30px;"><a href="http://astore.amazon.com/techno_photography-20?_encoding=UTF8&node=38" target="iframe">Lenses</a></li>
    <li style="margin-left:30px;"><a href="http://astore.amazon.com/techno_photography-20?_encoding=UTF8&node=39" target="iframe">Point-and-Shoot Digital Cameras</a></li>
    <li style="margin-left:30px;"><a href="http://astore.amazon.com/techno_photography-20?_encoding=UTF8&node=40" target="iframe">Surveillance Cameras</a></li>
    <li style="margin-left:20px;"><a href="http://67.222.96.12/~technomo/index.php?main_page=page&id=2" target="_self"><b>Computers</b></a></li>
    <li style="margin-left:20px;"><a href="http://67.222.96.12/~technomo/index.php?main_page=page&id=3" target="_self"><b>Electronics</b></a></li>
    <li style="margin-left:20px;"><a href="http://67.222.96.12/~technomo/index.php?main_page=page&id=4" target="_self"><b>Toys & Games</b></a></li>
    <li style="margin-left:20px;"><a href="http://67.222.96.12/~technomo/index.php?main_page=page&id=5" target="_self"><b>Wireless Accessories</b></a></li>

  7. #7
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: PHP Addressing

    Since you were asking in regard specifically to ez-pages links, I suggest using the approach suggested by clydejones.
    .

    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.

  8. #8
    Join Date
    Nov 2009
    Location
    Aransas Pass, TX
    Posts
    101
    Plugin Contributions
    1

    Default Re: PHP Addressing

    Quote Originally Posted by clydejones View Post
    if you using this in zen cart then this should produce the desired result:

    <?php echo '<a href="' . zen_ez_pages_link(1) . '" target="self">'; ?>
    That did not work. It did not display a live link. I ended up using

    <a href="<?php echo zen_ez_pages_link(1); ?>">Page 1</a>

    which works on my main page (or ezpage), but not in my sidebox.

    SideBox generated code --->
    http://localhost/technomonkeys/%3C?php echo zen_ez_pages_link(3); ?>

    MainPage generated code --->
    http://localhost/technomonkeys/index.php?main_page=page&id=1

    ZenCart 1.3.8
    PHP 5.2.6
    MySQL 5.0.67
    Glacial Age Template
    Editable_Sidebox_1.0 <--- This is where I need the mod

  9. #9
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: PHP Addressing

    define-pages aren't intended to be sucked into sideboxes, which is why using file_get_contents() isn't working for you.
    If you're comfortable taking the security risks posed by using eval(), you might consider wrapping eval() around your call to file_get_contents() so that its content is treated like PHP code, similar to how an include works normally when not stuffing its content into a variable.
    .

    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.

  10. #10
    Join Date
    Nov 2009
    Location
    Aransas Pass, TX
    Posts
    101
    Plugin Contributions
    1

    Default Re: PHP Addressing

    Quote Originally Posted by IATIA View Post
    I want to change this --->

    <a href="http://67.222.96.12/~technomo/index.php?main_page=page&id=1" target="_self">

    into this --->

    <a href="HTTP_SERVER/index.php?main_page=page&id=1" target="_self">
    Sometimes it is difficult to see the forest for the trees!
    Guess what the solution was? (I've got my dunce cap on, anyone else?)

    <a href="index.php?main_page=page&id=1" target="_self">

    It works in the sidebox or main page and is totally relocatable.

    ZenCart 1.3.8
    PHP 5.2.6
    MySQL 5.0.67
    Glacial Age Template
    Editable_Sidebox_1.0

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v154 canonical addressing for individual products
    By Pepperfire in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 16 Mar 2015, 04:18 PM
  2. Addressing the YOUR_TEMPLATE issue
    By mrcastle in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 4 Mar 2010, 09:21 PM
  3. Enable plus addressing for emails
    By mephy in forum General Questions
    Replies: 0
    Last Post: 10 Apr 2008, 11:50 PM

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