Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #14819 > unrolled thread

php _e question

Started bypigsfoot.trotter@gmail.com
First post2015-01-10 10:09 -0800
Last post2015-02-04 05:22 +0100
Articles 9 — 7 participants

Back to article view | Back to comp.lang.php


Contents

  php _e question pigsfoot.trotter@gmail.com - 2015-01-10 10:09 -0800
    Re: php _e question "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-01-10 19:41 +0100
      Re: php _e question pigsfoot.trotter@gmail.com - 2015-01-10 11:18 -0800
        Re: php _e question Tim Streater <timstreater@greenbee.net> - 2015-01-10 19:43 +0000
        Re: php _e question Jerry Stuckle <jstucklex@attglobal.net> - 2015-01-10 23:02 -0500
    Re: php _e question Richard Damon <Richard@Damon-Family.org> - 2015-01-10 15:32 -0500
    Re: php _e question pigsfoot.trotter@gmail.com - 2015-01-10 15:02 -0800
    Re: php _e question Denis McMahon <denismfmcmahon@gmail.com> - 2015-01-11 17:17 +0000
    Re: php _e question Arno Welzel <usenet@arnowelzel.de> - 2015-02-04 05:22 +0100

#14819 — php _e question

Frompigsfoot.trotter@gmail.com
Date2015-01-10 10:09 -0800
Subjectphp _e question
Message-ID<e2907cd1-e267-4b14-a298-3002f7f2dca6@googlegroups.com>
Hi,
I have some code within an ecommerce shop that i'm using as follows

<?php _e( 'No products were found matching your selection.', 'woocommerce' ); ?></p>

Is it possible to replace the 'No products were found matching your selection.'

with text, a hyperlink and an image?

I just want to format the message better and offer a link to somewhere else.

If so could someone tell me how please.

Thanks..

[toc] | [next] | [standalone]


#14820

From"Christoph M. Becker" <cmbecker69@arcor.de>
Date2015-01-10 19:41 +0100
Message-ID<m8rrp9$ko2$1@solani.org>
In reply to#14819
pigsfoot.trotter@gmail.com wrote:

> I have some code within an ecommerce shop that i'm using as follows
> 
> <?php _e( 'No products were found matching your selection.',
> 'woocommerce' ); ?></p>
> 
> Is it possible to replace the 'No products were found matching your
> selection.'
>
> with text, a hyperlink and an image?

Well, why don't you try it out?

> I just want to format the message better and offer a link to
> somewhere else.
> 
> If so could someone tell me how please.

As the question might be rather WooCommerce specific, have you
considered asking on <https://support.woothemes.com/hc/en-us>?

-- 
Christoph M. Becker

[toc] | [prev] | [next] | [standalone]


#14821

Frompigsfoot.trotter@gmail.com
Date2015-01-10 11:18 -0800
Message-ID<c3430f6f-32ba-4f86-8680-1f539d52411e@googlegroups.com>
In reply to#14820
Seriously... because you read a word "woocommerce" it automatically presume i should ask a PHP related question on that forum...

This question has nothing to do with woocommerce it is PHP code

If you don't know the answer then please do not reply... this may sound harsh but I help out on a awful lot of forums and there is nothing worse that comments that are of no relevance or help.

[toc] | [prev] | [next] | [standalone]


#14822

FromTim Streater <timstreater@greenbee.net>
Date2015-01-10 19:43 +0000
Message-ID<100120151943513384%timstreater@greenbee.net>
In reply to#14821
In article <c3430f6f-32ba-4f86-8680-1f539d52411e@googlegroups.com>,
<pigsfoot.trotter@gmail.com> wrote:

>Seriously... because you read a word "woocommerce" it automatically presume i
>should ask a PHP related question on that forum...

This is not really a PHP question.

>This question has nothing to do with woocommerce it is PHP code

You should do something like:

<p><?php _e ('Some text <a href="http://hostname/path/to/page">click
here</a> <img src="http://hostname/path/to/image">', 'woocommerce' );
?></p>

You haven't told us what _e is or does, and you'll note that everything
I put in there is HTML and not PHP. Neither have you told us what you
want the resulting message to look like - not that this makes your
question anything more to do with PHP.

-- 
"I am enclosing two tickets to the first night of my new play; bring a
friend.... if you have one." - GB Shaw to Churchill "Cannot possibly
attend first night, will attend second...  if there is one." - Winston
Churchill, in response.

[toc] | [prev] | [next] | [standalone]


#14825

FromJerry Stuckle <jstucklex@attglobal.net>
Date2015-01-10 23:02 -0500
Message-ID<m8ssjj$leb$1@dont-email.me>
In reply to#14821
On 1/10/2015 2:18 PM, pigsfoot.trotter@gmail.com wrote:
> Seriously... because you read a word "woocommerce" it automatically presume i should ask a PHP related question on that forum...
> 
> This question has nothing to do with woocommerce it is PHP code
> 
> If you don't know the answer then please do not reply... this may sound harsh but I help out on a awful lot of forums and there is nothing worse that comments that are of no relevance or help.
> 

This has EVERYTHING to do with woocommerce.  The call is a function call
in woocommerce, and we have no idea what it does.

When working with a package, your best best is to work with the support
forums for that package.  They know their product (and PHP code) better
than anyone else.

If you can't ask in the right place, don't bother asking here.  With
that kind of attitude, you won't find anyone willing to volunteer to
assist you.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================

[toc] | [prev] | [next] | [standalone]


#14823

FromRichard Damon <Richard@Damon-Family.org>
Date2015-01-10 15:32 -0500
Message-ID<j%fsw.1446173$1s.363677@fx05.iad>
In reply to#14819
On 1/10/15 1:09 PM, pigsfoot.trotter@gmail.com wrote:
> Hi,
> I have some code within an ecommerce shop that i'm using as follows
>
> <?php _e( 'No products were found matching your selection.', 'woocommerce' ); ?></p>
>
> Is it possible to replace the 'No products were found matching your selection.'
>
> with text, a hyperlink and an image?
>
> I just want to format the message better and offer a link to somewhere else.
>
> If so could someone tell me how please.
>
> Thanks..
>

A quick check on Google tells me that this looks like a Wordpress 
function _e which is used to echo strings out with possible localization 
replacement.

I am not familiar enough with Wordpress to give advice on the limits of 
the _e function, but as other have said, you could just give it a shot 
to add the link.

There may be tools in Wordpress to help build such a link/image, and it 
might even be required to use them (depends where the sanitation line is 
in Wordpress, good CMS's will sanitize input from the user to the output 
page safe from attacks).

[toc] | [prev] | [next] | [standalone]


#14824

Frompigsfoot.trotter@gmail.com
Date2015-01-10 15:02 -0800
Message-ID<fd61c8f3-e5f4-47dd-b967-7cd1b680c2ba@googlegroups.com>
In reply to#14819
Thanks Tim,
That was just wanted i needed to know.

All resolved now thanks

[toc] | [prev] | [next] | [standalone]


#14826

FromDenis McMahon <denismfmcmahon@gmail.com>
Date2015-01-11 17:17 +0000
Message-ID<m8ub6r$i2o$1@dont-email.me>
In reply to#14819
On Sat, 10 Jan 2015 10:09:35 -0800, pigsfoot.trotter wrote:

> I have some code within an ecommerce shop that i'm using as follows

> <?php _e( 'No products were found matching your selection.',
> 'woocommerce' ); ?></p>

> Is it possible to replace the 'No products were found matching your
> selection.' with text, a hyperlink and an image?

Without knowing what the _e function does (it's not core php, so 
presumably it's part of some library, either woocommerce itself or 
whatever woocommerce is built on top of) this is impossible to answer.

Perhaps someone in a woocommerce forum can tell you what sort of data is 
allowable as parameters to _e()

-- 
Denis McMahon, denismfmcmahon@gmail.com

[toc] | [prev] | [next] | [standalone]


#14853

FromArno Welzel <usenet@arnowelzel.de>
Date2015-02-04 05:22 +0100
Message-ID<54D19E8F.3080405@arnowelzel.de>
In reply to#14819
pigsfoot.trotter@gmail.com schrieb am 2015-01-10 um 19:09:
> Hi,
> I have some code within an ecommerce shop that i'm using as follows
> 
> <?php _e( 'No products were found matching your selection.', 'woocommerce' ); ?></p>
> 
> Is it possible to replace the 'No products were found matching your selection.'
> 
> with text, a hyperlink and an image?

Well - this is not really PHP specific but more a WordPress questions,
as Woocommerce is based on WordPress.

You can just put the required stuff in there, but don't forget to update
the translation as well (the respectiv PO/MO files) if English is not
the only language you use (I recommend using the Loco Translate plugin
for doing this in the WordPress backend):

<?php _e( 'No products were found matching your selection. <a
href="someurl">Here you find something else</a> <img src="foobar" alt=""
/>', 'woocommerce' ); ?></p>

JFTR:

_e() is a function provided by WordPress to output translation of a text
defined by the - either it will use the given text itself (literally -
so take care not to create invalid HTML with the text) or the
translation for the current language of the site if available.

Also see: <http://codex.wordpress.org/Function_Reference/_e>


-- 
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de
http://fahrradzukunft.de

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web