A while ago
ninetydegrees wrote me wonderful code to add Prev/Next links to the navlinks on most pages but I've noticed they're not on the Reply page. I checked here: http://wiki.dwscoalition.org/wiki/index.php/S2_Cookbook:_Modules (where I think someone put the code after giving it to me) but I don't see the specific s2 needed for them to show up there. I'd also like to get them on pages that have their URLs written like: http://mm-writes.dreamwidth.org/123456.html?replyto=123456 (not sure if that falls under the same request or if more s2 would be needed, so thought I'd mention it).
Also, for future s2 coding endeavors, is there any way for me to parse out on my own exactly what variations in the code I would need to do something like this? (When I tried small variations on the existing s2 I got various errors like "Can't find member 'prev_url' in ReplyPage", "Unknown type or class 'Reply'" and so on - I did try everything I could think of variation-wise).
Lastly, I'm trying to get the navlinks bar to a minimum width across the top of the page on all page views - without adding to the existing margins or padding because I'm trying to prevent text wrapping - but I realize the Prev/Next links would not be a good choice/not even be possible to add on say, the Archive and Month (not Day) pages so I want to do custom URLs just on those pages instead. How would I get the custom URLs to show up in the navlinks for just those two pages?
Thanks so much in advance!
no subject
Date: 2014-06-22 10:44 am (UTC)POV: I 'm not a programmer and am not formally trained in any IT sciences so I'll explain this the way I understand it.
When you look at http://www.dreamwidth.org/customize/advanced/layersource?id=550&fmt=html, you can see at the top all the things which are defined in the S2 code and that you can use. So all the classes and all the variables and methods within these classes (not sure about the jargon here but a Java tutorial seems to say these are the correct terms).
You can also see that there is some sort of hierarchy/inheritance system going on where some classes are extensions of other classes (class xxx extends yyy), meaning that elements within the parent class will work within its subclass (but not the other way around I believe).
Now if you look at the prev_url variable, it's part of the DayPage and MonthPage classes but not of ReplyPage or anything else ReplyPage is a child of (i.e. Page). It isn't a member of the ReplyPage class so it doesn't exist there which is why you got an error message.
Now if you look at the code for the EntryPage foxfirefey wrote you'll notice that it's a bit different because it uses Entry and get_link (and not prev_url but prev.url which is different).
Looking at Core2 again, get_link is a built-in function (method?) of EntryLite.
Builtin functions are built in higher part of the code. In this case the S2.pm file which can be found in the Dreamwidth repository: https://github.com/dreamwidth/dw-free/blob/develop/cgi-bin/LJ/S2.pm.
If you look for get_link you'll find it in sub _Entry__get_link, which I believe is an array. get_link can take the value of nav_prev and nav_next, which is what fey used. You can see how nav_prev and nav_next correspond to the previous/next entry URL and text link.
As ReplyPage has Entry as a member variable too (see Core2) we can use get_link there the same way it's done in EntryPage.
I don't know if this was clear enough but I hope it's helped a little at least.
no subject
Date: 2014-06-23 03:17 am (UTC)no subject
Date: 2014-06-23 04:11 pm (UTC)