Re: [PHP] nested tags

2004-01-14 Thread Gregor Jaksa
HTML tags.
I can have something like

  first
  
second table
  
  table


and i need to convert each  tags into something more user
friendly.

"David T-G" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

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



[PHP] nested tags

2004-01-14 Thread Gregor Jaksa
Can anyone provide me with some link or code on how to deal with nested
tags.

thx!

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



Re: [PHP] problem with preg_replace

2004-01-13 Thread Gregor Jaksa
Thx Erik, it works great except for one detail. It matches numbers too.
Can you fix it so it matches only words please ?

For example:
$file = 'this is a number 1231 test.';
$words = 'test|number';
Result: [tag]this[/tag] [tag]is[/tag] [tag]a[/tag] [tag]nu[/tag]
[sample]number[/sample] [tag]1231[/tag] [sample]test[/sample].

1231 should stay the same, without tags.

thx

<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello Gregor,
>
> On 13 Jan 2004 at 15:08, Gregor Jaksa wrote:
>
> > hello, i need to replace some words in file with [tag]word[/tag] and
other
> > words with [sample]word[/sample].
> >
> > i have a list of words which i need to replace with [sample] tags
declared
> > like
> > $words = 'word1|word2|word3|word4';
> >
> > replacing those words is easy i just use preg_replace('/\b( ' . $words .
> > ')\b/i', '[sample]$1[/sample]', $file);
> > but how to replace all other words that are not in $words array with
[tag]
> > tag ?
> >
> > thx in advance!
>
> Let me see if I understood you correctly: you want to surround all the
words in the string
> $file that are not also contained in the $words array with [tag] and
[/tag]?
>
> Here's an idea:
>
> 
> $file = 'this is my test string and I just want to use it for a quick
test';
> $words = 'test|string';
>
> $new_file = preg_replace('/\b('.$words.')\b/', ' [sample]$1[/sample] ',
$file);
>
> $new_file =
preg_replace('/\b(?  ' [tag]$1[/tag] ', $new_file);
>
> print $new_file;
>
> ?>
>
> Very important: you *must not* forget the spaces before and after the
opening and
> closing brackets in the replacement string.
>
> Good luck,
>
> Erik

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



[PHP] problem with preg_replace

2004-01-13 Thread Gregor Jaksa
hello, i need to replace some words in file with [tag]word[/tag] and other
words with [sample]word[/sample].

i have a list of words which i need to replace with [sample] tags declared
like
$words = 'word1|word2|word3|word4';

replacing those words is easy i just use preg_replace('/\b( ' . $words .
')\b/i', '[sample]$1[/sample]', $file);
but how to replace all other words that are not in $words array with [tag]
tag ?

thx in advance!

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



[PHP] eregi() problem

2002-04-21 Thread Gregor Jaksa

if (!eregi("^[[:alpha:]]$", $HTTP_POST_VARS["vpis_ime"]))
  echo "wrong char";

why does this always return "wrong char" no matter what value is in vpis_ime
... i tried "blah", "242234" "bla242h" .. every single time i get "wrong
char". im using PHP 4.1.2

basicly is what i want is to check string if it contains only charaters from
a to z and chars _ - [ ] . Can somebody write me a working function ?

thx in advance



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




[PHP] array in sessions

2001-12-17 Thread Gregor Jaksa

Hello,

is it possible to register array in session .. something like that:
session_register("ex_array[field1]");
session_register("ex_array[field2]");

this example of course doesnt work :), so if anyone knows a solution, plz
tell

thx



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] sockets question

2001-08-21 Thread Gregor Jaksa

One simple question:
I need to use the same socket connectin in 2 different scripts, is that
possible ? and if YES, then how to do it ?

for example:

i have login.php where i do
$socket_handle = fsockopen($server, $port);

now in add.php i would like to send msg to $socket_handle socket...

hope u know what i what...

thx



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] replacing part of string with values in array

2001-07-12 Thread Gregor Jaksa

hello,

ok heres the thing ;)
lets say i have array("part1", "part2", "part3", "part4");
now i have string like
$string = "here's PART and heres PART, another PART here and final PART
here";
now i wanna replace first PART in string with part1 from array and second
PART with part2 from array ...
one more thing is that i dont know how many parts there will be in string ..
but i know that array and string will have the same number of parts ;)

help plz :)



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] header() & session problem...

2001-05-05 Thread Gregor Jaksa

hello,
let me try to explain my problem..

i have one script in which i set some stuff like sessions and some
cookies...
now i need to call this script from almost every page on my site somehow
like
lets say i'm on page www.url.com/script.php?page=14 and then i call that
other function
Header("Location: /scripts/setvars.php?var1=foo&far2=foo2");

here's now the real problem..what should i put in setvars.php scripts so it
returns to the page i called it from ?
basicly i need to get back to script.php?page=14 ... can anyone help me
if anyone knows any better way i'll be glad to listen
one more thing, i cant use include(setvars.php) couze i need to refresh ...
so i can use cookies right away

and one more question bout sessions..when i set session like
session_register("foo"); do i need to refresh the page before i can use it
like $HTTP_SESSION_VARS["foo"] or can i use it right away ?
(couze first way doesnt work for me( i need to refresh ), maybe i'm doin
something wrong, so i would like some help on this too)

thx in advance




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] some array help :)

2001-03-10 Thread Gregor Jaksa

hello,

i'm trying to do something like

$tmparray = array("foo", "foo1", "foo2");
if ($i in $tmparray) then do something
..
but i dont know how to do it.
any help would be appriciated



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]