[personal profile] lastdance posting in [community profile] style_system
I've been reading S2 documentation like crazy, and I'm pretty sure the answer is 'no' but I'm going to throw out the question anyway:

Is there any possible way to call functions from a different view than the one you're currently on? For example, the EntryPage class has a function print_comments. But what if I want to print the subjects of the 5 latest comments on the Recent view (maybe in the sidebar)? The RecentPage class doesn't include that function, so I'm assuming there's no way to call it unless the core was rewritten to add it into RecentPage and allow it to take parameters so it knows which comments to pull back. Am I correct in that assumption?

I'll gladly take the question elsewhere if this isn't the right place. Any direction would be so much appreciated.

Date: 2009-05-06 04:06 pm (UTC)
afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
From: [personal profile] afuna
No, afraid it's not possible. The problem is that the individual comment data isn't available, unless you are on the entry page. (Completely separate in the backend, so that even if the S2 language syntax were to allow it, there wouldn't be any data to print out).

Date: 2009-05-06 05:49 pm (UTC)
afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
From: [personal profile] afuna
Aha. We do have the number of comments available for the current page. My guess is that that's how they're doing the sidebar (based on code for the page summary, but with modified text).

However, that only shows the number of comments made on the entry, not the time the last comment was made, or the actual comment metadata/text.

If my guess is correct, and they're doing it with pure s2, then the more accurate description of the information is "most popular posts on the front page/from the first 20 entries", though "of the past hour" probably works given the popularity of the community.

Date: 2009-05-06 06:52 pm (UTC)
afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
From: [personal profile] afuna
Hmm, probably not. If they are using a third-party API, and it's not entirely S2, then no amount of documentation on our end will make it clear, I'm afraid!

Date: 2009-05-07 09:26 pm (UTC)
av8rmike: Neo from Matrix, text: I know S2 (I know s2)
From: [personal profile] av8rmike
They're definitely using some kind of off-site tracker in PHP. You can see calls to 0x0 images in the page source (tables and un-validated HTML, ewww).

Date: 2009-05-07 02:28 am (UTC)
adalger: Earthrise as seen from the moon, captured on camera by the crew of Apollo 16 (Default)
From: [personal profile] adalger
I'm confused on this. Is it possible to extend class definitions, or define new classes, in a top-level layer?

Date: 2009-05-07 02:37 am (UTC)
afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
From: [personal profile] afuna
It's possible to define new classes, but not possible to extend class definitions.

(though you can make a new class that extends an existing class).

But I'm afraid I don't see the connection with my comment, and I'm worried that I'm giving the wrong impression of what is/is not possible, somehow.

Date: 2009-05-07 02:48 am (UTC)
adalger: Earthrise as seen from the moon, captured on camera by the crew of Apollo 16 (Default)
From: [personal profile] adalger
Okay. Is there any way to, say, extend the RecentPage class and then have that extended class be used in your layout in place of the pre-defined RecentPage class?

Date: 2009-05-07 02:58 am (UTC)
afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
From: [personal profile] afuna
Hmm, yes. But that doesn't solve the original problem, because you don't have the data available, unless you are visiting an actual entry.

Date: 2009-05-07 03:05 am (UTC)
adalger: Earthrise as seen from the moon, captured on camera by the crew of Apollo 16 (Default)
From: [personal profile] adalger
So, somewhere back in the coding, something only serves the data that fills the Comment[] array if the page passes the isa EntryPage test?

Date: 2009-05-07 03:13 am (UTC)
adalger: Earthrise as seen from the moon, captured on camera by the crew of Apollo 16 (Default)
From: [personal profile] adalger
kk. Now I understand. Now all I need is a coolhunter to say "This would be cool to have changed." ;)

Profile

Dreamwidth style system discussion

July 2025

S M T W T F S
  123 45
6789101112
13141516171819
20212223242526
2728293031  

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 12th, 2025 04:21 pm
Powered by Dreamwidth Studios