[RFC]Quote link to quoted message

These requests for comments/change have lead to an implemented feature that has been successfully merged into the 3.2/Rhea branch. Everything listed in this forum will be available in phpBB 3.2.
User avatar
brunoais
Registered User
Posts: 964
Joined: Fri Dec 18, 2009 3:55 pm

Re: [RFC]Quote link to quoted message

Post by brunoais »

Hum... There's this function:bbcode_quote() in message_parser.php...
I'll need some time to study that function and prepare it for the changes... I was thinking the changes were only in bbcode.php, actually, there's more needed for this job.
This will take a while.
Any help to speed this thing up is welcome

User avatar
imkingdavid
Registered User
Posts: 1050
Joined: Thu Jul 30, 2009 12:06 pm

Re: [RFC]Quote link to quoted message

Post by imkingdavid »

For the record, afaik the BBCode system is being revamped so this could probably wait a little while until that's done.
I do custom MODs. PM for a quote!
View My: MODs | Portfolio
Please do NOT contact for support via PM or email.
Remember, the enemy's gate is down.

User avatar
MichaelC
Development Team
Development Team
Posts: 889
Joined: Thu Jan 28, 2010 6:29 pm

Re: [RFC]Quote link to quoted message

Post by MichaelC »

viewtopic.php?f=84&t=33021 - New BBcode Engine for reference.
Formerly known as Unknown Bliss
psoTFX wrote: I went with Olympus because as I said to the teams ... "It's been one hell of a hill to climb"
No unsolicited PMs please except for quotes.

User avatar
Oyabun1
Former Team Member
Posts: 20
Joined: Thu Mar 31, 2011 9:48 am

Re: [RFC]Quote link to quoted message

Post by Oyabun1 »

There is code in this post, Re: In quote link back to original post, that works with the current version of phpBB (3.0.10).

User avatar
JoshyPHP
Registered User
Posts: 381
Joined: Fri Jul 08, 2011 9:43 pm

Re: [RFC]Quote link to quoted message

Post by JoshyPHP »

Code: Select all

[quote="brunoais" post="15"]dsd[/quote]
[quote="brunoais" source="http://www.phpbb.com/support/irc/"]dsd[/quote]
There's no source but there's an optional url attribute as described in this post.

Shouldn't post be called post_id? It's possible to add a post_id attribute that holds a number. It's possible to have a template that uses this number in a URL, something like this:

Code: Select all

<a href="{U_VIEWPOST}{NUMBER}">{L_BACK_TO_POST}</a>
It's possible to have another optional number that holds a timestamp but there's no built-in way to generate a localized date at display time. It's possible to use the core.text_formatter_s9e_render_before event to generate a localized date and inject it in the metadata before a formatted text is displayed. Or not use an event at all and just execute the same code in the relevant context.

User avatar
brunoais
Registered User
Posts: 964
Joined: Fri Dec 18, 2009 3:55 pm

Re: [RFC]Quote link to quoted message

Post by brunoais »

JoshyPHP wrote:

Code: Select all

[quote="brunoais" post="15"]dsd[/quote]
[quote="brunoais" source="http://www.phpbb.com/support/irc/"]dsd[/quote]
There's no source but there's an optional url attribute as described in this post.
url can replace source (in my spec), yes.
JoshyPHP wrote: Shouldn't post be called post_id? It's possible to add a post_id attribute that holds a number. It's possible to have a template that uses this number in a URL, something like this:

Code: Select all

<a href="{U_VIEWPOST}{NUMBER}">{L_BACK_TO_POST}</a>
L_BACK_TO_POST ? It is meant to be the link to the source post of the quote. The postId is used because the forum may change location and/or domain and, that way, it would still be working as it points to a post, not an URL.
JoshyPHP wrote: It's possible to have another optional number that holds a timestamp but there's no built-in way to generate a localized date at display time. It's possible to use the core.text_formatter_s9e_render_before event to generate a localized date and inject it in the metadata before a formatted text is displayed. Or not use an event at all and just execute the same code in the relevant context.
I think that could be solved by calling a php function from inside the XSL. What do you think?

User avatar
JoshyPHP
Registered User
Posts: 381
Joined: Fri Jul 08, 2011 9:43 pm

Re: [RFC]Quote link to quoted message

Post by JoshyPHP »

brunoais wrote:L_BACK_TO_POST ? It is meant to be the link to the source post of the quote.
Yes. L_BACK_TO_POST can be whatever string makes sense, that's just an example. U_VIEWPOST would be the static part of the URL for viewing a post, e.g. https://area51.phpbb.com/phpBB/viewtopic.php?p=. It would be set in PHP.
brunoais wrote:I think that could be solved by calling a php function from inside the XSL. What do you think?
There's no support in the library for executing arbitrary PHP while rendering a template. That's a Pandora's box I am careful not to open needlessly. That's why the simplest way to access or generate that kind of metadata is currently to inject it before rendering.

User avatar
brunoais
Registered User
Posts: 964
Joined: Fri Dec 18, 2009 3:55 pm

Re: [RFC]Quote link to quoted message

Post by brunoais »

Is it possible to add the preprocessing capability to your library to process variables before they are sent to the stylesheet?

User avatar
JoshyPHP
Registered User
Posts: 381
Joined: Fri Jul 08, 2011 9:43 pm

Re: [RFC]Quote link to quoted message

Post by JoshyPHP »

I think that what I'm going to do is offer a utility that rewrites attribute values inside of a parsed text (which is in XML.)

Most likely it'll be used like this:

Code: Select all

$xml = s9e\TextFormatter\Utils::replaceAttributes(
    $xml,
    'QUOTE',
    function ($attributes) use ($user)
    {
        if (isset($attributes['timestamp']))
        {
            $attributes['date'] = $user->format_date($attributes['timestamp']);
        }

        return $attributes;
    }
); 
:arrow: Grab all QUOTE tags, those that have a timestamp attribute get a date attribute that contains the localized date.

User avatar
brunoais
Registered User
Posts: 964
Joined: Fri Dec 18, 2009 3:55 pm

Re: [RFC]Quote link to quoted message

Post by brunoais »

How would quote be defined with that functionality?

Post Reply