vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   First Post per Page (https://vborg.vbsupport.ru/showthread.php?t=90980)

Whissi 06-24-2005 11:01 AM

First Post per Page
 
1 Attachment(s)
Hello,

I want, that every first post per site appears with ads (see the sceenshot).
I think, that I have to edit the "postbit-" template, I am using and add the code with conditionals. But this the problem: $perpage or $page doesn't work!

I tried
Code:

<if condition="$postcount == ($perpage * $page +1)">
Can someone help me please?

Princeton 06-24-2005 11:29 AM

have you tried
Code:

"$post[postcount] == 1"

akanevsky 06-24-2005 11:37 AM

Quote:

have you tried
This will also show up in announcements and PMs....

You should also make sure that this is a thread-retrieved post.

Princeton 06-24-2005 11:56 AM

Code:

THIS_SCRIPT==showthread AND $post[postcount] == 1

Whissi 06-24-2005 01:02 PM

But what if, if the thread has got about 2 or more pages? Every first post per page should show it.

akanevsky 06-24-2005 01:18 PM

O hmm then you need to edit the source code and make a custom counter :)

Princeton 06-24-2005 01:53 PM

FIND IN showthread.php:
Code:

                $post['musername'] = fetch_musername($post);
                $post['islastshown'] = ($post['postid'] == $lastpostid);

REPLACE WITH:
Code:

                $post['musername'] = fetch_musername($post);
                $post['islastshown'] = ($post['postid'] == $lastpostid);
// ================================================= \\
// == [ MODIFIED - GTP BEGIN ]
                $post['isfirstshown'] = ($post['postid'] == $FIRSTPOSTID);
// == [ 00-00-2004 - GTP END ]
// ================================================= \\

NOW IN postbit TEMPLATE:

FIND (at the bottom):
Code:

<if condition="$show['spacer']">
        </div>
        $spacer_close
</if>
<!-- / post #$post[postid] -->

REPLACE WITH:
Code:

<if condition="$post['isfirstshown'] OR $post['islastshown']">
<table class="tborder" id="post$post[postid]" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
        <td class="thead">Sponsors</td>
        <td class="alt1">
                <if condition="$post['isfirstshown']">this is the first post of every page
                <else />
                this is the last post of every page</if>
        </td>
</tr>
</table>
</if>

<if condition="$show['spacer']">
        </div>
        $spacer_close
</if>
<!-- / post #$post[postid] -->


Marco van Herwaarden 06-24-2005 02:06 PM

Just a question Princeton. Why do you use REPLACE instruction? No offence, but i always try to avoid them.

Princeton 06-24-2005 02:34 PM

I have found that most addon instructions use the following:
REPLACE, EDIT ADD BELOW, ADD ABOVE, CHANGE TO, ETC.

When you use a variety of the above in your addon instructions there is an increased chance that people will encounter errors (when copy/paste).

Here's your typical addon instructions:
ADD BELOW
ADD BELOW
ADD BELOW
ADD BELOW
ADD ABOVE
REPLACE
ADD ABOVE
ADD BELOW

VS.

REPLACE
REPLACE
REPLACE
REPLACE
REPLACE
REPLACE
REPLACE
REPLACE

Using REPLACE does the same job but it decreases errors.

LOL ... it's not full-proof but it has worked for me. :D

akanevsky 06-24-2005 02:35 PM

Quote:

Why do you use REPLACE instruction? No offence, but i always try to avoid them.
I agree. If you are not modifying the original code, it is better to post "add before" or "add after" instruction. So that if the code is a little bit different " due to another vb version ", it would be easier for new people to hack.

P.S. IMO, vB.org should post some hacking standards...

P.P.S. The minimod itself is good, good job princeton.


All times are GMT. The time now is 05:11 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01256 seconds
  • Memory Usage 1,737KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (7)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete