Re: [PHP] embedding php inside of php

2012-07-01 Thread Yared Hufkens
If you are using PHP 5.4 or short_open_tag is 1, you can also do this:

Some HTML text here?=subject?some more HTML text?=$text?and finally other 
stuff here


Am 01.07.2012 14:01, schrieb Tim Streater:
 On 01 Jul 2012 at 01:00, Tim Dunphy bluethu...@gmail.com wrote: 

 I am trying to get the hang of php using some examples that I found
 in a book. I've been making progress lately, but one thing has me a
 bit stumped.

 In an HTML form that I am echoing through PHP I would like to embed
 smaller chunks of php in the code like so:


 echo 'br /br /
form method=post action=sendemail.php
label for=subjectSubject of email:/labelbr /
input id=subject name=subject type=text value=?php
 echo $subject;?br /
label for=elvismailBody of email:/labelbr /
textarea id=elvismail name=elvismail rows=8
 cols=40?php echo $text;?   /textareabr /
input type=submit name=Submit value=Submit /
/form';

 You don't need the nested echoes. Just concatenate instead:

 echo 'br /br /
form method=post action=sendemail.php
label for=subjectSubject of email:/labelbr /
input id=subject name=subject type=text value=' . $subject . 
 'br /
label for=elvismailBody of email:/labelbr /
textarea id=elvismail name=elvismail rows=8
 cols=40' . $text . '   /textareabr /
input type=submit name=Submit value=Submit /
/form';

 In short you're doing this :

 echo 'Some HTML text here ' . $subject . ' some more HTML text ' . $text . ' 
 and finally other stuff here';

 --
 Cheers  --  Tim







Re: [PHP] regexp novice

2012-05-17 Thread Yared Hufkens
Try this:
/(0?[1-9]|[12][0-9]):?[0-5][0-9]/

FYI: ? is equal to {0,1}, and [1-9] to [123456789] (and therefore [1-2]
to [12]).


Am 17.05.2012 22:37, schrieb Jim Giner:
 ok - finally had to come up with my own regexp - and am failing.

 Trying to validate an input of a time value in the format hh:mm, wherein 
 I'll accept anything like the following:
 hmm
 hhmm
 h:mm
 hh:mm

 in a 12 hour format.  My problem is my test is ok'ing an input of 1300.

 Here is my test:

  if (0 == preg_match(/([0][1-9]|[1][0-2]|[1-9]):[0-5][0-9]/,$t))
 return true;
 else
 return false;

 Can someone help me correct my regexp? 




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



Re: [PHP] Best PHP Template System

2012-04-25 Thread Yared Hufkens
Why use an external engine which slows your scripts down to do something which 
can easily be done by PHP itself? PHP is imho the best template engine for PHP.
With PHP 5.4, it became even easier because ?=$do-somestuff()? can be used 
without short_open_tag enabled.
However, you always schould divide UI and backend.

--- Ursprüngl. Mitteilung ---
Von: Willie Matthews
Gesend.:  25.04.2012, 23:48 
An: PHP Mailinglist
Betreff: [PHP] Best PHP Template System


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I have been looking at Smarty Template Engine. The only reason I don't
like it is because it is really slow when there are a bunch of results
for pagination.

Question is, is there something out there that is a lot faster with
pagination built into it? Also with the features of Smarty Template
Engine?

- -- 
Willie Matthews
matthews.wil...@gmail.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.17 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPmHE9AAoJEPyaSMdprRSF+swH/jkXqfzG+uHE/g7HleLnRIa+
Ld0QYCIXPA1xdv5yPl3HndxPkMeCbvmqPCcdCchQR+2QGV2vOi/P+LycJbh01jb0
ht1BGb+MsOikyT+sNn2VYT1kjKENwZ3VJ4tsjTaGZl9Si98NZGAhCdzAhvkIvB8t
xavbA8eX7y6fKpaGMmV5fOfPDSxavLMy0T7ox2mmLo7UBFcjRyd+Icghdd7rSK34
WH8Wd/nhpcX4E/zCc0D1zEnfzWP/Z7yS0GJi/sLSGpZcs7AyAvQV60XKCSuABBRf
z23n0wrdSmgjbahGFalmog+9u5JxceCxwQ9ZT4tzOgoihLwhwZCUYFxyaWv5jyI=
=jMqu
-END PGP SIGNATURE-

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



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



Re: [PHP] Help! Having trouble getting one XML field from this feed reliably

2012-02-09 Thread Yared Hufkens
I wonder why you use cURL as SimpleXML itself can load URLs:

$vastdata = new
SimpleXMLElement('http://afe.specificclick.net/?l=32259t=xrnd=123456',0,true);

See http://de.php.net/manual/en/simplexmlelement.construct.php


Am 09.02.2012 04:44, schrieb Rob Gould:
 Can anyone tell me what I'm doing wrong here?  I'm trying to get the 
 VASTAdTagURI field from the XML data at this url:

 http://afe.specificclick.net/?l=32259t=xrnd=123456




 Here's my code.  (below).  It works maybe 30% of the time, but most of the 
 time it just returns nothing from that field.  Yet when I go to the above url 
 in Firefox, I always see the data.  This is very strange.





 // Lets get the ad!

 $curl_handle=curl_init();
 curl_setopt($curl_handle,CURLOPT_URL,'http://afe.specificclick.net/?l=32259t=xrnd=123456');
 curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2);
 curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
 $buffer = curl_exec($curl_handle);
 curl_close($curl_handle);

 $vastdata = new SimpleXMLElement($buffer);

 $vasturi = $vastdata-Ad-Wrapper-VASTAdTagURI;

 echo If the script works, vasturi =  . $vasturi;

 echo brbrbr;

 print_r($vastdata);








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



[PHP] PHP-GTK: GladeXML::get_widget() doesn't find some widgets

2012-02-09 Thread Yared Hufkens
I have a Glade file with this widget:

child
  widget class=GtkTextView id=errLog
property name=visibleTrue/property
property name=can_focusTrue/property
property name=editableFalse/property
property name=cursor_visibleFalse/property
property name=accepts_tabFalse/property
  /widget
  packing
property name=expandTrue/property
property name=fillTrue/property
property name=position2/property
  /packing
/child

which is a child of a GtkVBox (errContainer), which is a child of a
GtkWindow (errWindow), and I want to write something into it:

function openErr($message) {
logError($message);

$window = glade()-get_widget('errWindow');
$log = glade()-get_widget('errLog');

$buf = new GtkTextBuffer();
$buf-set_text(file_get_contents(LOG_FILE) or Cannot read file 
.LOG_FILE.!);

$log-set_buffer($buf);
$log-modify_font(new PangoFontDescription('Monospace'));

$window-show_all();
}


But get_widget() doesn't find errLog: I get a Fatal Error and
var_dump($log) outputs null. errWindow gets found anyway, and if I
comment the two lines with $log-method() out, errWindow appears on the
screen too.

How can I get the object of errLog?

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



[PHP] PHP-GTK dead?

2012-01-10 Thread Yared Hufkens
It seems that PHP-GTK is completely dead. The latest version (2.0.1) was
released on May 2008, nobody answers on questions in the mailing list,
and the latest SVN commit is nearly one year ago.

Am I wrong or is it senseless to write still PHP-GTK programs?

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