php-general Digest 7 Feb 2011 08:44:06 -0000 Issue 7170
Topics (messages 311173 through 311176):
Re: latest posts help
311173 by: Ashley Sheridan
Re: Bilingual strtotime()
311174 by: Alexis
311175 by: Raymond Irving
Re: String length output in php-generated response
311176 by: Ford, Mike
Administrivia:
To subscribe to the digest, e-mail:
[email protected]
To unsubscribe from the digest, e-mail:
[email protected]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
"Michael Simiyu" <[email protected]> wrote:
>hello , am working on showing the last 3 posts showed on a message
>board ( bitweaver ) and i would like to know what to add on the below
>line of code to show the last 3 this is what i have that shows the
>last post
>
>Code:
><a href="{$board.last.url}" title="{$board.last.title|
>default:"Post..."}">{$board.last.title|default:"Post..."|truncate:40}</
>
>a>
>
>
>what should i add to the code above to pull the last 3 posts so i
>could have it like this... (the code below just shows the latest in a
>list format )
>
>Code:
>{if !empty($board.last)}
>» <a href="{$board.last.url}" title="{$board.last.title|
>default:"Post..."}">{$board.last.title|default:"Post..."|truncate:40}</
>
>a>
> <br/>
> » <a href="{$board.last.url}"
>title="{$board.last.title|default:"Post..."}">{$board.last.title|
>default:"Post..."|truncate:40}</a>
> <br/>
> » <a href="{$board.last.url}"
>title="{$board.last.title|default:"Post..."}">{$board.last.title|
>default:"Post..."|truncate:40}</a>
> <br/>
> {/if}
>
>
>
>Best Regards
>Michael S.
This is a php list, so we can only really answer questions about php. That code
looks like a smarty template (although correct me if I'm wrong) while smarty is
written in php, they are not the same thing.
Thanks
Ash
http://www.ashleysheridan.co.uk
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
--- End Message ---
--- Begin Message ---
On 06/02/11 04:54, Ashley Sheridan wrote:
On Sun, 2011-02-06 at 11:24 +0100, Peter Lind wrote:
On Feb 6, 2011 11:16 AM, "Per Jessen"<[email protected]> wrote:
Alexis wrote:
I was wondering if there was a way to use the strtotime() function
when the months are in one or the other of the above two languages?
Ah, I misread this earlier - strtotime(), not strftime(). You're
talking about transforming from text to a locale()-neutral format. I
don't think strtotime() is locale-sensitive - according to the manual:
"The function [strtotime] expects to be given a string containing an
English date format"
Strtotime can read a number of formats, but does (from experience) have
problems with some. It won't work with textual dates in anything but
English, far as I know.
Regards
Peter
Is there an example of the different date formats so that we can see
what we're working with here? It sounds like it might require a little
manual intervention first (str_replace() maybe) in order for this to
work.
Thanks,
Ash
http://www.ashleysheridan.co.uk
So basically, the answer is no :)
Looks like I'll simply do a replace of the French named months with
English ones.
Would have thought the length of time that PHP has been around and with
people around the world, speaking more than just one language, that
language support would have progressed further than it appears to have.
Apparently not.
But thanks for all the suggestions.
Alexis
--- End Message ---
--- Begin Message ---
Yeah I think that's the only way out for now.
I had to do something similar when using strftime() but the same can be done
when using strtotime(). You just have to be careful with abbreviated names.
Check out the source code
here:http://code.google.com/p/raxan/source/browse/trunk/raxan/sdk/raxan/pdi/shared/raxan.datetime.php
Best regards,__Raymond
--- On Sun, 2/6/11, Alexis <[email protected]> wrote:
From: Alexis <[email protected]>
Subject: Re: [PHP] Bilingual strtotime()
To:
Cc: [email protected]
Date: Sunday, February 6, 2011, 3:38 PM
On 06/02/11 04:54, Ashley Sheridan wrote:
> On Sun, 2011-02-06 at 11:24 +0100, Peter Lind wrote:
>
>> On Feb 6, 2011 11:16 AM, "Per Jessen"<[email protected]> wrote:
>>>
>>> Alexis wrote:
>>>
>>>> I was wondering if there was a way to use the strtotime() function
>>>> when the months are in one or the other of the above two languages?
>>>
>>> Ah, I misread this earlier - strtotime(), not strftime(). You're
>>> talking about transforming from text to a locale()-neutral format. I
>>> don't think strtotime() is locale-sensitive - according to the manual:
>>>
>>> "The function [strtotime] expects to be given a string containing an
>>> English date format"
>>>
>>>
>>>
>>
>> Strtotime can read a number of formats, but does (from experience) have
>> problems with some. It won't work with textual dates in anything but
>> English, far as I know.
>>
>> Regards
>> Peter
>
>
> Is there an example of the different date formats so that we can see
> what we're working with here? It sounds like it might require a little
> manual intervention first (str_replace() maybe) in order for this to
> work.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>
So basically, the answer is no :)
Looks like I'll simply do a replace of the French named months with
English ones.
Would have thought the length of time that PHP has been around and with
people around the world, speaking more than just one language, that
language support would have progressed further than it appears to have.
Apparently not.
But thanks for all the suggestions.
Alexis
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Florin Jurcovici [mailto:[email protected]]
> Sent: 06 February 2011 15:57
> I'm trying to build myself a small JSON-RPC server using PHP.
>
> Using wireshark, here's the conversation:
>
> Request:
[...snip...]
> Response:
> HTTP/1.1 200 OK
> Date: Sun, 06 Feb 2011 15:04:08 GMT
> Server: Apache/2.2.14 (Ubuntu)
> Accept-Ranges: bytes
> X-Powered-By: PHP/5.3.2-1ubuntu4.7
> Keep-Alive: timeout=15, max=100
> Connection: Keep-Alive
> Transfer-Encoding: chunked
> Content-Type: application/json; charset=UTF-8
>
> 6f
> {"id":2,"result":{"service":"test.service","method":"method",
> "id":2,"params":[{"code":"client"}]},"error":null}
> 0
That's nothing to do with PHP -- it's http chunked encoding, as
indicated by the "Transfer-Encoding: chunked" header, and is handled
by Apache and your browser. It's totally expected and totally
harmless. Read about it here:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.6
Cheers!
Mike
--
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,
Leeds Metropolitan University, C507 City Campus,
Woodhouse Lane, LEEDS, LS1 3HE, United Kingdom
Email: [email protected]
Tel: +44 113 812 4730
To view the terms under which this email is distributed, please go to
http://disclaimer.leedsmet.ac.uk/email.htm
--- End Message ---