Results 1 to 10 of 14

Hybrid View

  1. #1
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Simple question for PHP programmers, hard for me!

    If the value of the constant can properly be set before the page displays each time, then PHP inside the define will be okay if written properly. If the currency could be reset without reloading the page, that would be a problem, as the define would not be reset. Your whole issue is that the PHP is inside the text string. It needs to be concatenated with the text parts, like this:
    PHP Code:
    define('TEXT_FREESHIPPING_SIDEBOX''
        FREE SHIPMENT OF ORDERS OVER ' 
    $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) . '
    '
    ); 
    or maybe
    PHP Code:
    define('TEXT_FREESHIPPING_SIDEBOX''<br />    FREE SHIPMENT OF ORDERS OVER ' $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) . '<br />'); 

  2. #2
    Join Date
    May 2010
    Location
    Athens, Greece
    Posts
    292
    Plugin Contributions
    0

    Default Re: Simple question for PHP programmers, hard for me!

    Thank you very much Glenn. My question wasn't that stupid after all.

    I have now worked it and added a "free insurance" definition with format('500'). The full define line is now:

    PHP Code:
    define('TEXT_FREESHIPPING_SIDEBOX''FREE SHIPMENT<br />OF ORDERS OVER<br />' $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) . '<br /><br />FREE INSURANCE<br />OF ORDERS OVER<br />' $currencies->format('500') . '<br />');?> 
    Added some styling and it's now displaying properly in a left column side box on my live site.

    This forum is a great help and I'm glad to learn something new every day, either by asking or by reading posts by other users. Many thanks to all you gurus who spend your time to help us novices.

  3. #3
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Simple question for PHP programmers, hard for me!

    It would also be fully appropriate to split the constant into two or more strictly text constants, and output each of them around the currency output in the module file or the tpl_ file. There is more than one way you can get correctly functioning output. In some cases, the correct value of a variable will not be known when the constant is defined, so the method shown would not work.

  4. #4
    Join Date
    May 2010
    Location
    Athens, Greece
    Posts
    292
    Plugin Contributions
    0

    Default Re: Simple question for PHP programmers, hard for me!

    Thanks again Glenn, you've come to my rescue more than once in the past. I really appreciate your help and always learn from reading your posts.

 

 

Similar Threads

  1. Simple CSS/PHP AntiSpam solution for a contact form
    By dlg_ie in forum All Other Contributions/Addons
    Replies: 130
    Last Post: 24 Jan 2017, 05:04 PM
  2. v150 Wanted: Simple Capthcha for Forms, Maybe a Random Question or Image
    By jonisolis in forum General Questions
    Replies: 1
    Last Post: 14 Aug 2013, 09:21 PM
  3. A simple question for PHP programmers
    By HTMLGoddess in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 19 Jul 2008, 10:59 AM
  4. Suggestion for you heavy duty Zen programmers
    By mrogowski in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 5 Apr 2008, 08:09 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