php-general Digest 11 Apr 2013 17:19:27 -0000 Issue 8191

Topics (messages 320819 through 320828):

Re: Is BBCode Installed
        320819 by: Stephen
        320820 by: David Robley

[ask] convert unknown format Japanese string to readable string
        320821 by: Morning Star
        320822 by: KOYAMA Tetsuji

how to insert html code with PHP
        320823 by: Rafnews
        320824 by: Jim Giner
        320825 by: tamouse mailing lists
        320826 by: Rafnews
        320827 by: Rafnews
        320828 by: Jim Giner

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
On 13-04-10 10:59 PM, David Robley wrote:
I ran phpinfo() on my host and searched for "BBCode". Not found.

Does this mean that the extension is not installed?

If not, how can I tell?

Thanks

BBCode isn't a php extension, but may be implemented using php or other
languages. See http://www.bbcode.org/ for more info.

Thank you for replying, but:

http://php.net/manual/en/book.bbcode.php


 Introduction

This extension aims to help parse BBCode text in order to convert it to HTML or another markup language. It uses one pass parsing and provides great speed improvement over the common approach based on regular expressions. Further more, it helps provide valid HTML by reordering open / close tags and by automatically closing unclosed tags.



--
Stephen


--- End Message ---
--- Begin Message ---
Stephen wrote:

> On 13-04-10 10:59 PM, David Robley wrote:
>> I ran phpinfo() on my host and searched for "BBCode". Not found.
>>
>> Does this mean that the extension is not installed?
>>
>> If not, how can I tell?
>>
>> Thanks
>>
>> BBCode isn't a php extension, but may be implemented using php or other
>> languages. See http://www.bbcode.org/ for more info.
>>
> Thank you for replying, but:
> 
> http://php.net/manual/en/book.bbcode.php
> 
> 
>   Introduction
> 
> This extension aims to help parse BBCode text in order to convert it to
> HTML or another markup language. It uses one pass parsing and provides
> great speed improvement over the common approach based on regular
> expressions. Further more, it helps provide valid HTML by reordering
> open / close tags and by automatically closing unclosed tags.
> 
> 
That appears to be a PECL extension, not 'core' php and more info on 
installing can be found at http://www.php.net/manual/en/install.pecl.php.

Not having used PECL extensions, I can't say whether they are reflected in 
phpinfo() output.

-- 
Cheers
David Robley

SCUD : Sure Could Use Directions


--- End Message ---
--- Begin Message ---
Hi guys,

i have a string like this:
$string = \u3053\u3093\u306b\u3061\u306f\u30ef\u30fc\u30c9
(Japanese words that say "hello world" in English)
How can I convert that $string to Japanese character?
It should be こんにちは世界


my regards,

Marco

--- End Message ---
--- Begin Message ---
Hi,

On Thu, Apr 11, 2013 at 5:39 PM, Morning Star
<morning.star.c...@gmail.com> wrote:
> Hi guys,
>
> i have a string like this:
> $string = \u3053\u3093\u306b\u3061\u306f\u30ef\u30fc\u30c9
> (Japanese words that say "hello world" in English)
> How can I convert that $string to Japanese character?
> It should be こんにちは世界

I found tips in the stackoverflow.

http://stackoverflow.com/questions/2934563/how-to-decode-unicode-escape-sequences-like-u00ed-to-proper-utf-8-encoded-cha

I try it.

<?php
$str = "\u3053\u3093\u306b\u3061\u306f\u30ef\u30fc\u30c9";

function replace_unicode_escape_sequence($match) {
    return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE');
}
$str = preg_replace_callback('/\\\\u([0-9a-f]{4})/i',
                             'replace_unicode_escape_sequence', $str);
var_dump($str);


Then it displays:
string(24) "こんにちはワード"

regards,

-- 
    KOYAMA Tetsuji
    koy...@hoge.org

--- End Message ---
--- Begin Message ---
Hi,

I would like to insert a piece of HTML code inside several pages.
all pages are differently named.

i need in each page to find a particular tag, let's say <div id="#submenu">...</div> (so based on its ID and tagname) and inside it to insert my PHP/HTML code.

how can i do that ?

thx.

A.

--- End Message ---
--- Begin Message ---
On 4/11/2013 7:34 AM, Rafnews wrote:
Hi,

I would like to insert a piece of HTML code inside several pages.
all pages are differently named.

i need in each page to find a particular tag, let's say <div
id="#submenu">...</div> (so based on its ID and tagname) and inside it
to insert my PHP/HTML code.

how can i do that ?

thx.

A.
How many pages are we talking about?

--- End Message ---
--- Begin Message ---
On Apr 11, 2013 6:35 AM, "Rafnews" <raf.n...@gmail.com> wrote:
>
> Hi,
>
> I would like to insert a piece of HTML code inside several pages.
> all pages are differently named.
>
> i need in each page to find a particular tag, let's say <div
id="#submenu">...</div> (so based on its ID and tagname) and inside it to
insert my PHP/HTML code.
>
> how can i do that ?

I am a little confused. If you want to insert the same bit of code in a php
file, use the include function.

If you need to do same thing across a number of pages, you probably have
found a spot to refactor your code.

If your talking about inserting it in real time in the client's browser,
you want jQuery/AJAX for that, not php.

(php can serve up the HTML in response to an AJAX request, though)

>
> thx.
>
> A.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
On 11.04.2013 14:14, Jim Giner wrote:
On 4/11/2013 7:34 AM, Rafnews wrote:
Hi,

I would like to insert a piece of HTML code inside several pages.
all pages are differently named.

i need in each page to find a particular tag, let's say <div
id="#submenu">...</div> (so based on its ID and tagname) and inside it
to insert my PHP/HTML code.

how can i do that ?

thx.

A.
How many pages are we talking about?

This really depends on CMS itself and its templates

--- End Message ---
--- Begin Message ---
On 11.04.2013 13:34, Rafnews wrote:
Hi,

I would like to insert a piece of HTML code inside several pages.
all pages are differently named.

i need in each page to find a particular tag, let's say <div id="#submenu">...</div> (so based on its ID and tagname) and inside it to insert my PHP/HTML code.

how can i do that ?

thx.

A.

Ok i can write an include_once('myfile.php');

however if i have an array in this file, other files where is the include_once(); do not recognize the array.

here is an extract of this file to include (submenu.php):
<?php
$submenu = array();
$submenu[] = array('id' => 1,'class'=>'menuitem1');
$submenu[] = array('id' => 2,'class'=>'menuitem2');

// function in the same file
function DisplayMenu($title){
// here i do not have access to the previous array $submenu define outside the function
 ...
}

as it is included the function DisplayMenu should also have access to $submenu array, no ?




--- End Message ---
--- Begin Message ---
On 4/11/2013 10:48 AM, Rafnews wrote:
On 11.04.2013 13:34, Rafnews wrote:
Hi,

I would like to insert a piece of HTML code inside several pages.
all pages are differently named.

i need in each page to find a particular tag, let's say <div
id="#submenu">...</div> (so based on its ID and tagname) and inside it
to insert my PHP/HTML code.

how can i do that ?

thx.

A.

Ok i can write an include_once('myfile.php');

however if i have an array in this file, other files where is the
include_once(); do not recognize the array.

here is an extract of this file to include (submenu.php):
<?php
$submenu = array();
$submenu[] = array('id' => 1,'class'=>'menuitem1');
$submenu[] = array('id' => 2,'class'=>'menuitem2');

// function in the same file
function DisplayMenu($title){
  // here i do not have access to the previous array $submenu define
outside the function
  ...
}

as it is included the function DisplayMenu should also have access to
$submenu array, no ?



basic php question. Variables within any function are local to that function (except for superglobals like $_POST, $_SESSION, etc.). In order to reference a var defined/used outside that function you must add a global statement in the function:

function xxxx()
{
   global $submenu;

...
...
}

--- End Message ---

Reply via email to