John Ryan | 1 Nov 2003 01:37
Picon
Picon

Generating Numbers from Strings

I've a bit of a problem, I want a random keyword pulled from my database.
But I dont want it random all the time. I just want it random to each page.
So I have the filename variable of the page. How do I somehow generate a
'constant' random number from this string that is constant to each file???

TIA

--

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

Thomas Seifert | 1 Nov 2003 02:40

Re: Generating Numbers from Strings

On Sat, 1 Nov 2003 00:37:32 -0000 celticfc <at> iol.ie (John Ryan) wrote:

> I've a bit of a problem, I want a random keyword pulled from my database.
> But I dont want it random all the time. I just want it random to each page.
> So I have the filename variable of the page. How do I somehow generate a
> 'constant' random number from this string that is constant to each file???
> 
> TIA

md5(__FILE__) ?

Thomas

--

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

John Ryan | 1 Nov 2003 03:14
Picon
Picon

Re: Generating Numbers from Strings

I've done that, but how do I generate a number out of that that's in a
certain range?

"Thomas Seifert" <thomas-lists <at> myphorum.com> wrote in message
news:20031101014027.6e2ca9f2.thomas-lists <at> myphorum.com...
> On Sat, 1 Nov 2003 00:37:32 -0000 celticfc <at> iol.ie (John Ryan) wrote:
>
> > I've a bit of a problem, I want a random keyword pulled from my
database.
> > But I dont want it random all the time. I just want it random to each
page.
> > So I have the filename variable of the page. How do I somehow generate a
> > 'constant' random number from this string that is constant to each
file???
> >
> > TIA
>
> md5(__FILE__) ?
>
>
> Thomas

--

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

Robert Cummings | 1 Nov 2003 04:01
Favicon
Gravatar

Re: Php processor and return window

On Fri, 2003-10-31 at 14:53, Robb Kerr wrote:
> I am just learning PhP. When I was teaching myself Lingo (Macromedia
> Director's programming language) I found an object called the MESSAGE
> window quite helpful. This window allowed you to execute little snippets of
> code and get the results without having to execute your entire script. For
> instance, you could create a variable and give it a value then run an
> if/then statement or loop on it and quickly see the results. This is quite
> convenient when you're learning the language because you can test your
> syntax line-by-line instead of having the whole script fail and not knowing
> exactly where the error occurred.
> 
> Does anyone know about anything like this for PhP?

Absolutely, it's called the browser window. Grow your scripts from small
working blocks, and you can test in exactly the same way.

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.          |
`------------------------------------------------------------'

--

-- 
(Continue reading)

Pedro Pais | 1 Nov 2003 04:23
Picon

Templates/Separate content from presentation

Hi!

I've coded in PHP for a while, but I had to leave it for some time. Now 
I'm back, and I'd like to know what's currently being used to separate 
content from presentation, besides Smarty (that seems to be Google's top 
choice)?

Thanx

--

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

Filip de Waard | 1 Nov 2003 04:16
Picon

Re: Re: Generating Numbers from Strings

On Sat, 2003-11-01 at 01:37, John Ryan wrote: 
> I've a bit of a problem, I want a random keyword pulled from my database.
> But I dont want it random all the time. I just want it random to each page.
> So I have the filename variable of the page. How do I somehow generate a
> 'constant' random number from this string that is constant to each file???

Could you refrase your question? I understand a part of what you are
trying to do, but i'm missing the whole picture.

On Sat, 2003-11-01 at 03:14, John Ryan wrote:
> I've done that, but how do I generate a number out of that that's in a
> certain range?

mt_rand($start, $end); generates a 'random' number between two given
numbers.

Filip de Waard

--

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

Greg Donald | 1 Nov 2003 04:52

Re: Templates/Separate content from presentation

> I've coded in PHP for a while, but I had to leave it for some time. Now
> I'm back, and I'd like to know what's currently being used to separate
> content from presentation, besides Smarty (that seems to be Google's top
> choice)?

I tried Smarty for several weeks and found it was more than I needed, so I
went back to my simpler template system.

I have templates that look like this for example:

> cat userImage.tpl
<!-- userImage Template -->
<tr>
        <td><a href="index.php?i=$imageID"><img
src="thumbnail.php?i=$imageID" $imageHeightWidth border="0"
alt="$imageAltText" title="$imageAltText" /></a></td>
        <td nowrap="nowrap">$userType</td>
        <td align="center">$commentsCountHTML</td>
        <td align="center">$totalPoints</td>
        <td align="center">$timesRated</td>
        <td align="center">$averageRating</td>
</tr>
<!-- End userImage Template -->

Then in my php scripts I call a template like this:

$userImage = getTemplate("userImage");
eval("\$userImage = \"$userImage\";");
$html .= $userImage;

(Continue reading)

Curt Zirzow | 1 Nov 2003 05:22
Picon

Re: php temp table question (for mysql)

* Thus wrote Larry Brown (larry.brown <at> dimensionnetworks.com):
> I'm now finding that persistent connections is allowing the temp table to
> remain.  I have a sql query that creates the table and another that joins
> the temp table to another for a result set that I use. If I press refresh on

How are you creating the temp table?

> the browser window I get an error that the sql query creating the table
> fails.  I prepend a query that removes the table before the sql that creates
> it and then hit refresh and the query works.  If I close the browser thus
> ending the session and reopen the browser and log in, the script fails to
> remove the temp table since it hasn't been created yet (and must have been
> removed).  I changed my method of connecting to use mysql_connect instead of
> mysql_pconnect and removed the drop temp sql and it loads and reloads fine.
> Perhaps it is the combination of mysql_pconnect with sessions that creates
> this problem.

If this is the case it most likey is a mysql issue not a php one.

Curt
-- 
"My PHP key is worn out"

  PHP List stats since 1997: 
    http://zirzow.dyndns.org/html/mlists/

--

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

(Continue reading)

Robert Cummings | 1 Nov 2003 05:52
Favicon
Gravatar

Re: Templates/Separate content from presentation

On Fri, 2003-10-31 at 22:23, Pedro Pais wrote:
> Hi!
> 
> I've coded in PHP for a while, but I had to leave it for some time. Now 
> I'm back, and I'd like to know what's currently being used to separate 
> content from presentation, besides Smarty (that seems to be Google's top 
> choice)?

TemplateJinn, part of the InterJinn framework. Absolutely fantastic
(bias warning :) Too much to properly give credit in a single email,
feel free to check out the very full docs at the link below:

    http://www.interjinn.com/documentation/templateJinn.phtml

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.          |
`------------------------------------------------------------'

--

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

Greg Beaver | 1 Nov 2003 05:54
Favicon

Re: Templates/Separate content from presentation

Hi Pedro,

try http://www.phpsavant.com

Regards,
Greg

Pedro Pais wrote:

> Hi!
> 
> I've coded in PHP for a while, but I had to leave it for some time. Now 
> I'm back, and I'd like to know what's currently being used to separate 
> content from presentation, besides Smarty (that seems to be Google's top 
> choice)?
> 
> Thanx

--

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


Gmane