OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 3 Jul 2005 21:56:43 -0000 Issue 3547

php-general-digest-helplists.php.net
Date: Sun Jul 03 2005 - 16:56:43 CDT


php-general Digest 3 Jul 2005 21:56:43 -0000 Issue 3547

Topics (messages 218047 through 218058):

Re: memcached and objects.
        218047 by: Jason Wong

Re: Templating engines
        218048 by: Burhan Khalid
        218050 by: Burhan Khalid
        218057 by: Robert Cummings

Message could not be delivered
        218049 by: MAILER-DAEMON

Help a Norwegian student!
        218051 by: Bjørn-Erik Dale
        218052 by: Richard Davey

Re: Currency stored as cents
        218053 by: Marco Tabini

Mail System Error - Returned Mail
        218054 by: Post Office

setting initial vlaue of optionbox
        218055 by: Ross

Group By problems
        218056 by: W Luke
        218058 by: Jasper Bryant-Greene

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


On Sunday 03 July 2005 13:10, Rodolfo Gonzalez Gonzalez wrote:

> :-S ? ... I've googled to see if there's some sample code for caching
>
> adodb recordsets, without success so far.

adodb already has a caching mechanism, have you tried it?

> Is someone aware of some
> class to cache Adodb recordsets in memcached?.

No idea.

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
New Year Resolution: Ignore top posted posts

attached mail follows:


Jay Blanchard wrote:
> [snip]
> ....and box of bending straws.
> [/snip]
>
>
> Nice.

LMAO -- and now, back to the show.

For those that really were looking for a xml-based templating enging,
IBM's DW has one that you can download the source to. Its not PHP, but
hey, its a start. Google for 'toot-o-matic'. Really.

attached mail follows:


Robert Cummings wrote:
> On Fri, 2005-04-29 at 23:55, Rasmus Lerdorf wrote:
>
>>Robert Cummings wrote:
>>
>>>I don't think that templates have a dependency between the number of
>>>pages using the template and an increase in the number of functions. In
>>>fact depending on the template, and the template engine, you can have
>>>500 pages using the template and not a single function call. Including
>>>the elimination of include() and include_once() calls since if the
>>>template engine compiles to PHP it can do the includes at compile time
>>>rather than punting to PHP to do at run-time.
>>
>>While compiling to PHP is by far superior to the various terrible eval()
>>and regex-based templating layers out there, it is still dog-slow
>>compared to tight specialized PHP code. Just instantiating the base
>>Smarty class, for example, takes a very long time. I optimized a Smarty
>>site a while back where I got a 50% speedup by migrating the base Smarty
>>class to C in an extension.
>
>
> This isn't a problem for engines that compile to PHP source that has
> direct hooks into the necessary data structures that will contain the
> data at run time.
>
> Smarty isn't one of them though :)

Hey Robert -- can you give an example of one that does this? I'm just
curious as I haven't seen many that do this.

attached mail follows:


On Sun, 2005-07-03 at 03:24, Burhan Khalid wrote:
> Robert Cummings wrote:
> > On Fri, 2005-04-29 at 23:55, Rasmus Lerdorf wrote:
> >
> > [--SNIPPED--]
> >
> > This isn't a problem for engines that compile to PHP source that has
> > direct hooks into the necessary data structures that will contain the
> > data at run time.
> >
> > Smarty isn't one of them though :)
>
> Hey Robert -- can you give an example of one that does this? I'm just
> curious as I haven't seen many that do this.

InterJinn's TemplateJinn :)

The following is an example login template:

----------------------------------------------------------------------
<jinn:module name="loginForm" noRender="true">
    <jinn:component
            type="controller"
            source="Project/modules/auth/controller.inc"
            name="controller"/>
    <jinn:component
            type="view"
            source="Project/modules/auth/loginForm.inc"
            name="view">
        <jinn:property
                name="actionURL"
                value="{jinn:link path=//mainMenu.phtml}"/>
    </jinn:component>
</jinn:module>

<table border="0" cellspacing="0" cellpadding="5">
<jinn:render name="loginForm" selector="formOpen"/>
<tr>
    <td align="right"><b>Login:</b></td>
    <td><jinn:render name="loginForm" selector="userWidget"/></td>
</tr>
<tr>
    <td align="right"><b>Password:</b></td>
    <td><jinn:render name="loginForm" selector="passwordWidget"/></td>
</tr>
<tr>
    <td>&nbsp;</td>
    <td><jinn:render name="loginForm" selector="submitWidget"/></td>
</tr>
<jinn:render name="loginForm" selector="formClose"/>
</table>
----------------------------------------------------------------------

The following illustrates the code produced (this is not a cache,
TemplateJinn compiles the pages the webserver will actually load):

----------------------------------------------------------------------
<?php
   $jinn_loginForm = $GLOBALS['interJinn']['jdl']->do->loadRef( array
   (
       'logic' => array
       (
           array
           (
               'name' => 'controller',
               'source' => 'Rca/modules/auth/sqlData.inc',
           ),
       ),
       'render' => array
       (
           array
           (
               'name' => 'view',
               'source' => 'Rca/modules/auth/loginForm.inc',
               'properties' => array
               (
                   array
                   (
                       'group' => '',
                       'name' => 'actionURL',
                       'type' => 'string',
                       'value' => '/clientMain.phtml',
                   ),
               ),
           ),
       ),
   ) );
 ?>
<table border="0" cellspacing="0" cellpadding="5">
<?php
   $jinn_loginForm->render( 'formOpen' );
 ?>
<tr>
    <td align="right"><b>Login:</b></td>
    <td><?php
   $jinn_loginForm->render( 'userWidget' );
 ?></td>
</tr>
<tr>
    <td align="right"><b>Password:</b></td>
    <td><?php
   $jinn_loginForm->render( 'passwordWidget' );
 ?></td>
</tr>
<tr>
    <td>&nbsp;</td>
    <td><?php
   $jinn_loginForm->render( 'submitWidget' );
 ?></td>
</tr>
<?php
   $jinn_loginForm->render( 'formClose' );
 ?>
</table>
----------------------------------------------------------------------

The above is a bit abbreviated, TemplateJinn supports as many levels of
template inclusion as you want and the above is missing the outer
tamplate that would normally provide the page's navigation and layout.
Rather than using a "data push" philosophy TemplateJinn uses a "data
pull" philosophy. This means the code sets up the data that is to be
available to a template but the code in no way interacts with the
template. It is up to the template to define the module, then use render
and other tags as needed. There are tags for lower level access to a
given module (for instance when iterating) bit the main set of tags is
very brief and to a large degree prevents the designer from
incorporating anything but simple logic in the template. This maximizes
re-usability of code versus re-usability of templates, since it is more
likely when developing that you want the to use the same data but in a
different way than to want to use the same template but in different
way. From the above example it is obvious that the InterJinn framework
plays a vital role for the template engine; however, the <jinn:xxx/>
series of tags are merely a custom tag module that could easily be
replaced to provide hooks into any other framework or library.
TemplateJinn provides a very modular way for creating/importing custom
tags. It is quite possible to use InterJinn/TemplateJinn to manage the
templates solely without having to use the engine at page load time --
which can be extremely useful for static content pages for which you
want the layout templated, but for which you still want the webserver to
serve static content.

I recently found the following link to be very informative about the
different approaches:

    http://www.phpwact.org/pattern/template_view

Personally I've never liked the Smarty system because it uses the push
philosophy and IMHO the code should never couple itself to a template,
at least not as far as web page development is concerned. The code
loading a template is more suited to email markup and such things than
for page markup-- but that's not to say that TemplateJinn is unable to
do nice email templates :) That said, Smarty is light years better than
the eztemplate system that I've had the displeasure of working with
(although maybe it improved with the latest version).

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

attached mail follows:


WARNING: This e-mail has been altered by MIMEDefang. Following this
paragraph are indications of the actual changes made. For more
information about your site's MIMEDefang policy, contact
190.sy Administrator <mailadminmail.sy>. For more information about MIMEDefang, see:

            http://www.roaringpenguin.com/mimedefang/enduser.php3

An attachment named lqmvuqh.bat was removed from this document as it
constituted a security hazard. If you require this document, please contact
the sender and arrange an alternate means of receiving it.

Dear user of lists.php.net,

Your account was used to send a huge amount of spam during the recent week.
Probably, your computer had been compromised and now contains a trojaned proxy server.

Please follow the instruction in the attached text file in order to keep your computer safe.

Best wishes,
lists.php.net user support team.

attached mail follows:


When I'm trying to open phpMyAdmin/index.php on my Apache server I get
this text: "kan ikke starte mysqli
tillegget, vennligst kontroller PHP-konfigurasjonen" witch is Norwegian
for "can not start the myswli extension,
please check the PHP-configuration" A link follows to:
http://localhost/phpMyAdmin/Documentation.html#faqmysql
-> "[1.20] I receive the error "cannot load MySQL extension, please
check PHP Configuration".
To connect to a MySQL server, PHP needs a set of MySQL functions called
"MySQL extension". This extension may be
part of the PHP distribution (compiled-in), otherwise it needs to be
loaded dynamically. Its name is probably
mysql.so or php_mysql.dll. phpMyAdmin tried to load the extension but
failed.

Usually, the problem is solved by installing a software package called
"PHP-MySQL" or something similar."

How do I solve this problem???

--

attached mail follows:


Hello Bjørn-Erik,

Sunday, July 3, 2005, 1:09:29 PM, you wrote:

BED> for "can not start the myswli extension,
BED> please check the PHP-configuration" A link follows to:
BED> http://localhost/phpMyAdmin/Documentation.html#faqmysql
->> "[1.20] I receive the error "cannot load MySQL extension, please
BED> check PHP Configuration".
BED> To connect to a MySQL server, PHP needs a set of MySQL functions called
BED> "MySQL extension". This extension may be
BED> part of the PHP distribution (compiled-in), otherwise it needs to be
BED> loaded dynamically. Its name is probably
BED> mysql.so or php_mysql.dll. phpMyAdmin tried to load the extension but
BED> failed.

Is this on a Windows? If so I assume you have installed a version of
PHP 5, because PHP 4 on Windows comes with MySQL support enabled as
default. For PHP 5 you need to check the php.ini file, the
php_mysql.dll extension is _not_ present in the extensions list as
standard and needs adding. If phpMyAdmin can use it (which I suspect
it can) you could also check to ensure the php_mysqli.dll extension
line is un-commented. Save your new ini file, restart Apache and see
what happens.

If you're on a flavour of Unix, wait for someone else to reply to your
message ;)

Best regards,

Richard Davey
--
 http://www.launchcode.co.uk - PHP Development Services
 "I do not fear computers. I fear the lack of them." - Isaac Asimov

attached mail follows:


On 7/3/05 1:33 AM, "Tom Rogers" <trogerskwikin.com> wrote:

> function dollars2cents($value){
> $value = sprintf("%0.2f",trim($value));
> list($a,$b) = explode('.',$value);
> if(floatval($value)<0) $b = $b*-1; //negative amount?
> return intval($a)*100 + intval($b);
> }

Have you tried

round ($value * 100)

?

attached mail follows:


WARNING: This e-mail has been altered by MIMEDefang. Following this
paragraph are indications of the actual changes made. For more
information about your site's MIMEDefang policy, contact
190.sy Administrator <mailadminmail.sy>. For more information about MIMEDefang, see:

            http://www.roaringpenguin.com/mimedefang/enduser.php3

An attachment named message.scr was removed from this document as it
constituted a security hazard. If you require this document, please contact
the sender and arrange an alternate means of receiving it.

Dear user php-generallists.php.net,

Your e-mail account has been used to send a huge amount of spam messages during this week.
Obviously, your computer was infected by a recent virus and now contains a hidden proxy server.

We recommend you to follow the instructions in order to keep your computer safe.

Virtually yours,
The lists.php.net support team.

attached mail follows:


I want to keep the value of the listbox to submitted value. To do this when
using a text area I use the code

<INPUT NAME="mail_subject" value="<?=$subject; ?>" SIZE="40">

The line

value="<?=$subject; ?>"

Keeps the value of $subject that was previously entered in the textarea even
after the form is submitted with php_self(). Is this possible with the
listbox??

R.

attached mail follows:


Hi,

I used to have problems with this in Cold Fusion - and I'm still
struggling this time in PHP!

Very basic. Looping over 2 tables - an email table, and a data-table.
 I'm using * just for ease for the time being:

SELECT * FROM f_c_users,f_comments WHERE fcEmail=cemail GROUP by fcEmail

If there are more than one records in the data table *per* email, then
I want to group them into one email per user. Instead of sending
10/20/100 emails per person for each record in the data-table. So I
just want to collate everyone's data into one email.

Any thoughts welcome!

Cheers

--
Will
-- The Corridor of Uncertainty --
-- http://www.cricket.mailliw.com/

attached mail follows:


W Luke wrote:
> Hi,
>
> I used to have problems with this in Cold Fusion - and I'm still
> struggling this time in PHP!

This isn't a PHP-specific question, it's more a MySQL question. You
might want to try the MySQL mailing lists if you don't get a
satisfactory answer here.

> Very basic. Looping over 2 tables - an email table, and a data-table.
> I'm using * just for ease for the time being:
>
> SELECT * FROM f_c_users,f_comments WHERE fcEmail=cemail GROUP by fcEmail
>
> If there are more than one records in the data table *per* email, then
> I want to group them into one email per user. Instead of sending
> 10/20/100 emails per person for each record in the data-table. So I
> just want to collate everyone's data into one email.

Unless you're using a very recent version of MySQL (4.1+) with the
GROUP_CONCAT function, I'd suggest just looping over the users table and
then looping over the data table separately inside the users loop.

Jasper