Recent Topics

1 Apr 24, 2008 23:14    

My b2evolution Version: Not Entered

yes, i am assigning hypothetical tasks to the each page of my software website : P

which i mean, every 1st page of each post will be "introduction", 2nd pages will always be used for "older versions", 3rd will be used for "tutorials" etc.. u get the idea.

i ve kinda figured out what to do.. instead of making a plugin (because that i am not capable of), i ve dealt with it by inserting links in the skin, single.post.php..(permanent.url?page=2 3, 4 etc.)

what i need is;
when you have 5 pages in your post, it displays 1,2,3,4,5, you know, but as i am going to disable that function, i will use the links that i ve inserted; i would like to display those links when they are available, i mean like in that example, i d like it to display "tutorials" link, only if a 3rd page is available in the post for instance...

hoping i could make it clear, any help or tip will be appreciated, thank you in advance..

3 Apr 26, 2008 02:14

I must say: that is a *beautiful* font you've got there :roll:

Something I'm not understanding here perhaps you can clarify for me: if you want each page to be a specific bit why don't you write your posts that way? In other words there will never be a third page that is NOT a tutorial of some kind unless you make a multi-page post and do not use the third page as a tutorial.

I guess I'm not seeing what you're after?

4 Apr 26, 2008 04:45

EdB wrote:

I must say: that is a *beautiful* font you've got there :roll:

Something I'm not understanding here perhaps you can clarify for me: if you want each page to be a specific bit why don't you write your posts that way? In other words there will never be a third page that is NOT a tutorial of some kind unless you make a multi-page post and do not use the third page as a tutorial.

I guess I'm not seeing what you're after?

i will already write my posts that way..

the only thing is, those links are just links that i ve inserted respectively, as ?page=2 ,3,4,5

what i want is just, NOT to display the 4th link, if there is not a 4th page available (which means post is exactly 3 pages)..

anyhow it's no big deal, i just wanted to know if it is possible, it sounded possible to me, like that multi page function, it only shows 4 links when you have 4 pages but i guess it is not possible as my links are not interactive they are just pre defined links..

5 Apr 26, 2008 04:48

Ah now I see. So what you would ideally be after is a way to automagically have it give you the text instead of the number. Positioning it and styling it is, you know, stuff you would have to do. Alternatively to mesh with what you have you would want something like "if post has 3 pages show 3 buttons but if it has 4 pages show 4 buttons" and so on. Do I now have it understood?

6 Apr 26, 2008 13:42

EdB wrote:

"if post has 3 pages show 3 buttons but if it has 4 pages show 4 buttons" and so on. Do I now have it understood?

yup.. that's it basically

7 Apr 26, 2008 15:08

Okay cool. Ready for a core file hack? I am! Hot Dawg ain't nothin' like a little core hacking in the morning! Right now I am looking at the function that generates the list of page numbers. Seems it might be in two places, but this bit in skins/_item_content.inc.php tells me I know where to hack:

		// Links to post pages (for multipage posts):
		$Item->page_links( '<p class="right">'.T_('Pages:').' ', '</p>', ' &middot; ' );


Notice that it is doing it the old-school way where you have to feed it parameters in the proper order? That tells me to dig into inc/items/model/_item.class.php and make it use words instead of numbers. Which looks quite easy. I'm at lines 1352 to 1356 and am seeing this:

		for( $i = 1; $i <= $this->pages; $i++ )
		{
			$text = str_replace('%d', $i, $pagelink);

			if( $i != $current_page )

So let's make it do our thing even though we know it's a core hack and therefore something you will need to forever track and update as you upgrade which I know you will do without worry or concern because you're a b2evo junkie and you won't be able to not upgrade even though you know upgrading will eat your core hacks. Where the hell was I? Oh yeah: replacing numbers with text. Change that bit to this:

		for( $i = 1; $i <= $this->pages; $i++ )
		{
			$text = str_replace('%d', $i, $pagelink);
			// change $text by seeing a number and replacing with actual text
			switch( $i ) 
			{ 
				case '1':
					$text = 'ALPHA'; // use the text you want to of course
					break;
				case '2':
					$text = 'BETA'; // use the text you want to of course
					break;
				case '3':
					$text = 'GAMMA'; // use the text you want to of course
					break;
				case '4':
					$text = 'DELTA'; // use the text you want to of course
					break;
				case '5':
					$text = 'EPSILON'; // use the text you want to of course
					break;
				default:
					$text = 'OMEGA'; // for pages after page #5
					break;
			}

			if( $i != $current_page )

This is, of course, completely untested. I'm pretty sure it will work and if not it's probably got a minor tweak that ain't right somewhere. Stupid syntax or whatever.

You will have to alter your skins/_item_content.inc.php file to get the pagination above the post content so simply copy it to the actual skins/skinname folder and you're set up. You also will probably want to style the links to make it look like boxes, so that would mean changing the "before" value after you copy/paste and edit the _item_content.inc.php file, but all that is up to you. First step of course is to see if the stupid hack actually works. If it does it's because I totally rock. If not it's because ¥åßßå messed up something in the core.

Oh and it is very possible to find a place or ten where it gives numbers again IF it gives words on the main page. If so then figuring out a similar hack for inc/items/model/_itemlistlight.class.php would be required ... but I think it won't be needed.

Sometimes it takes more time to write about a hack than to make the hack. ;)

8 Apr 26, 2008 15:56

hey edb, thanks for the response, i will try it right away..

Actually i was thinking of using image links, replacing the text links, but i did not mention it as i thought i could do it easily by hacking the posts.main.php inserting images to corresponding posts..

Is there a way to change those
$text to $img's.. you know what i mean :P.. or is it doable by inserting a <div class = plinks> after

// Links to post pages (for multipage posts):
      $Item->page_links( '<p class="right">'.T_('Pages:').' ', '</p>', ' &middot; ' ); 
<div class = plinks>


and include "plinks" class in the stylesheet for example;

.pagelink.plinks{
display:block;
background-image:url( img/picture.jpg);
} 

but the css thing is does not seem right, as i am pretty sure a ".pagelink" style exists in the core but "pagelink1" 2 , 3 etc does not exist...

anyhow; when you were writing this response, i was preparing another post which will possibly piss you off :oops: , but this post is rather about linkchecking and it is possibly not doable; so if it's not, simply say , "it's not" and pass on ...

here is the scratch how it will look like :

http://i25.tinypic.com/288w6bo.jpg

This is easy to do , by simply hacking the skin, inserting image links to pages of posts;

but.. when a 4th or 5th page is not available, the visitor will click on the 4th or 5th page and will get a "404" which i wouldn't like..

and here is the annoying idea;
is it possible to display another image, instead of the default one, when the link is not available, (with a sort of linkchecking feature)

visual example:

http://i30.tinypic.com/2dlu5ie.jpg

PS: i will be glad if you could respond even if those are weird ideas;
simply say "No, no, maybe, and no." ;)

Thank you all for taking your time.. Cheers.. brb with the results

Edit, Result: got a :

Parse error: syntax error, unexpected '{' in /home/prosoftwar/domains/prosoftwarez.com/public_html/blogs/inc/items/model/_item.class.php on line 1357

9 Apr 26, 2008 16:34

Too much for me to think about. So one thing at a time...

If you want images instead of words that's easy. In the hack change

$text = 'ALPHA'; // use the text you want to of course

to something like

$text = '<img src="mydomain/images/whatever/alpha.png" alt="link to alpha page" />'; // use the image you want to of course


Poof. Instant images instead of text.

If you want text and images it's a little tricker but the same thing. Change those lines to something like this:

$text = 'ALPHA<br /><img src="mydomain/images/whatever/alpha.png" alt="link to alpha page" />'; // use the text and image you want to of course


I'm not sure how that would actually work once you get to the visitor's browser though. Actually I'm sure it would suck. You would have to somehow get all the bits onto one line even though each bit is broken into two lines. So that means you probably have to make it be a UL with each LI having a BR in it. Doable, but not by me!

One of the screen shots shows the image link method at the top and the traditional page numbers linked below. That too can be done, but you would have to copy the entire function I hacked and paste it (right below itself) with a new function name, then call the new function name at the top of the post and the traditional function name at the end of the post.

Assuming the hack works there is no need to worry about pages that don't exist. The only time you have to worry about pages that don't exist is when you manually put the extra (top or text/images) set of pagination links in. Having said that, I am quite certain one could do a bit of trickery to have it count how many pages there are and then stop making the extra set of links when you've already made the right number.

But wait a second let me key in on one detail...
tilqicom wrote:

PS: i will be glad if you could respond even if those are weird ideas;
simply say "No, no, maybe, and no." ;)

Okay sure. No, no, maybe, and no. Hope it helps!

10 Apr 26, 2008 16:52

: ) that is good enough i suppose, "showing images to pagination links, when they are available" great.

thanking you, will see how it works and be back with the results , when i figure out when to put what instead of "{" in

Parse error: syntax error, unexpected '{' in /home/prosoftwar/domains/prosoftwarez.com/public_html/blogs/inc/items/model/_item.class.php on line 1357

11 Apr 26, 2008 17:19

Okay my bad. Try changing $switch to switch meaning get rid of the dollar sign.

$switch = 'BAD HACK!';

switch = 'GOOD HACK!';

I will edit the hack above to reflect this.

12 Apr 26, 2008 17:37

yup.. so far so good, it is working with the text links, will test soon with the img's and edit this post..

thank you in advance for taking your time, i do appreciate your (you and everyone else's) efforts.. see you soon


Form is loading...