Recent Topics

<?php link_pages() ?> + Clean urls?

Started by on Sep 09, 2004 – Contents updated: Sep 09, 2004

Sep 09, 2004 23:12    

Is it possible to have <?php link_pages() ?> generate clean urls?
What about <?php posts_nav_link(); ?>

Can I specify what skin/template I want to use to display the information in if someone clicks that link?

Where can I find the parameters for that function?

Thanks for the help

Sep 09, 2004 23:33

To answer your first question, no. You probably could with some hacking, or maybe Isaac can come up with some .htaccess trickery, but no method springs to mind.

For the second question, I'll have to search through the code (not at a computer with it on at the moment), since I can't find it in the [url=http://doc.b2evolution.net/0.9.0]tech docs[/url]. You might want to have a look through there yourself, you might find the answer in there.

I'll post again if I find the answer - no gaurantees though!

Sep 09, 2004 23:52

Problem is: I have Show/hide JavaScript that shows the title of the post, but hides the post contents. When the show/hide button is clicked it shows the post which is great untill they click on a page number. When that happens it reloads the page that shows the post's title with the post contents collasped. I wanted it to display showing all the contents expanded. I don't want it to show the post collasped.

So I figured the only way around this would be to create 2 skins per blog. One skin that shows the blog posts collasped, and one skin that shows the post expanded. The stubs will default to the collasped skin, and the blogs will be set to show using the expanded skin in the backoffice.

-->This will only work if you can set the skin/template to be used for the <?php link_pages() ?>. Otherwise a person would click on Pages: 1 2 3 and it would simply reload the collasped skin instead of linking to post using the expanded skin.

Any thoughts around this?

Sep 10, 2004 17:48

It's on my personal todo list to come up with a scheme like this:
http://example.com/stub/url_title/N

So, page 2 would be
http://example.com/stub/url_title/2

For those of you who haven't extracted the dates out of the permalinks, it would look something like
http://example.com/stub/2004/09/10/url_title/2

There's two parts for this. The first is changing the function that generates the links, and the second is changing the code that chews the url.

GMan, I'm not sure what problem you're trying to solve with the multiple skins thing.

Sep 10, 2004 18:56

Isaac,

Let me know if you get that url sheme to work. That would fix my problems. Sounds pretty cool B)

As for the skins thing, I was just telling why I needed the clean permalinks for the <?php link_pages() ?>.

How does b2evo know when to display the full contents of the post? I need some kind of flag in my skin that says

if accessed through stub or index
include javascript to collaspe the post contents and only show post title.
else
if accessed through permalink, more link, pages link,
then don't include javascript so that the post contents appear expanded.

Do you follow me? I have a JS script that shows and hides elements when clicked. So, in my case a person clicks on the post title and then it shows the full post's content. This allows me to save on screen real estate by only displaying the post's title.

Here is the problem:
If they accessed the page through a permalink it would show only the post title - which is no good - I want them to be able to see the full post expanded - which is why I need some kind of flag in my skin.

Any thoughts on how I could make that flag like above in my skin?

Sep 10, 2004 20:12

Sure. Put something like this in your _main.php file in your skin:

Code

if($more || $disp == 'single')
{
  // do the stuff that you do with permalinks
}
else
{
  // do the stuff that you do for non-single post pages.  archives, main page, etc.
}
Keep in mind: JavaScript is client-side, so you're still actually sending the full post content to the browser, and then hiding it with JavaScript. That means a longer download time to view your page, since it's downloading the full content for many posts at once. But, since the content is already there, and it doesn't have to go to a separate page to grab the full post, it'll expand out much more quickly.
What that also means is that, if someone expands just that post, and then bookmarks the page, then when they come back, it won't show the post expanded any more. (Unless your JavaScript is setting cookies or something.)

Sep 10, 2004 20:55

Fantastic,

I'll give it shot.

Thanks Isaac


Form is loading...

open source blog tool – This forum is powered by b2evolution CMS, a complete engine for your website.