Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 04-24-2009, 11:37 PM
Chadi's Avatar
Chadi Chadi is offline
 
Join Date: May 2004
Location: USA
Posts: 2,043
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 0-9 Link?

Hi folks. Need some little help here.

I have this mod I released that shows an ABC link nav menu for any specific forum the code is placed into.

https://vborg.vbsupport.ru/showthread.php?t=211939

The letters are linked like this:

<a rel="nofollow" href="http://www.yourdomain.com/forumdisplay.php?f=2&letter=a">A</a>

However, I'd like to add another link for numbers, but one link for any number: 0-9 and the link would be "#" not "0-9". Clicking the link would show all threads that begin with any number.

How can I achieve this?

Thanks.
Reply With Quote
  #2  
Old 04-25-2009, 12:40 AM
Dead Eddie's Avatar
Dead Eddie Dead Eddie is offline
 
Join Date: Apr 2004
Location: at Home...
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't remember the code for that one, but at some point it hooked into a query with code like :

where $something = $letter

You'll need to do a conditional. If $letter == '#', your query is going to look like:

where $something BETWEEN 0 AND 9

I'm rebuilding my computer at the moment, so I didn't look at the mod. If you need more help, I'll reinstall that and take a second look. Also, I didn't test it, but in theory it should work.
Reply With Quote
  #3  
Old 04-25-2009, 01:27 AM
Chadi's Avatar
Chadi Chadi is offline
 
Join Date: May 2004
Location: USA
Posts: 2,043
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Eddie, but I don't know anything about programming past the assistance I was given. If you can figure it out, great thanks.
Reply With Quote
  #4  
Old 04-25-2009, 02:50 AM
Dead Eddie's Avatar
Dead Eddie Dead Eddie is offline
 
Join Date: Apr 2004
Location: at Home...
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Untested...so try it on a test install first:

PHP Code:
if(isset($_GET['letter'])) {
    
$vbulletin->input->clean_GPC('r''letter''TYPE_STR);
    $letter = $db->escape_string($vbulletin->GPC['
letter']);

    if($letter == '
#') {
        
$hook " AND LEFT(thread.title, 1) BETWEEN 0 AND 9";
    }
    else {
        
$hook " AND LEFT(thread.title, 1) = '$letter'";
    }

    
$hook_query_where .= $hook;

Also, change the hook location in the file you've released to forumdisplay_query_threadid. That might solve some people's problems.
Reply With Quote
  #5  
Old 04-25-2009, 03:54 PM
Chadi's Avatar
Chadi Chadi is offline
 
Join Date: May 2004
Location: USA
Posts: 2,043
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks, but what am I supposed to do with that code? Where does it go in the plugin file?
Reply With Quote
  #6  
Old 04-25-2009, 05:25 PM
Dead Eddie's Avatar
Dead Eddie Dead Eddie is offline
 
Join Date: Apr 2004
Location: at Home...
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That's the updated code. It replaces what's in the plugin.

Also, I looked at the vbseo version, and it doesn't look like it was changed (except that it uses the correct hook). So, I'm wondering if there's either a change that didn't get picked up with the plugin, or if there really needs to be two different files.
Reply With Quote
  #7  
Old 04-27-2009, 03:30 AM
Chadi's Avatar
Chadi Chadi is offline
 
Join Date: May 2004
Location: USA
Posts: 2,043
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Ed. Still confused though.

The plugin now is this:

Code:
<?xml version="1.0" encoding="ISO-8859-1"?>

<product productid="asp_thread_listing" active="1">
    <title>Thread Listing by Letter</title>
    <description>Listing of threads by the first letter of the title</description>
    <version>.1</version>
    <url />
    <versioncheckurl />
    <dependencies>
    </dependencies>
    <codes>
    </codes>
    <templates>
    </templates>
    <plugins>
        <plugin active="1" executionorder="5">
            <title>Add Where Letter</title>
            <hookname>forumdisplay_query</hookname>
            <phpcode><![CDATA[if(isset($_GET['letter'])){
$vbulletin->input->clean_GPC('r', 'letter', TYPE_STR);

$letter = $db->escape_string($vbulletin->GPC['letter']);

$hook_query_where .= " AND LEFT(thread.title, 1) = '$letter'";

}]]></phpcode>
        </plugin>
    </plugins>
    <phrases>
    </phrases>
    <options>
    </options>
    <helptopics>
    </helptopics>
    <cronentries>
    </cronentries>
    <faqentries>
    </faqentries>
</product>
With your changes, is it supposed to look like this?

Code:
<?xml version="1.0" encoding="ISO-8859-1"?>

<product productid="asp_thread_listing" active="1">
    <title>Thread Listing by Letter</title>
    <description>Listing of threads by the first letter of the title</description>
    <version>.1</version>
    <url />
    <versioncheckurl />
    <dependencies>
    </dependencies>
    <codes>
    </codes>
    <templates>
    </templates>
    <plugins>
        <plugin active="1" executionorder="5">
            <title>Add Where Letter</title>
            <hookname>forumdisplay_query</hookname>
            <phpcode><![CDATA[if(isset($_GET['letter'])) {
    $vbulletin->input->clean_GPC('r', 'letter', 'TYPE_STR);
    $letter = $db->escape_string($vbulletin->GPC['letter']);

    if($letter == '#') {
        $hook = " AND LEFT(thread.title, 1) BETWEEN 0 AND 9";
    }
    else {
        $hook = " AND LEFT(thread.title, 1) = '$letter'";
    }

    $hook_query_where .= $hook;
}]]></phpcode>
        </plugin>
    </plugins>
    <phrases>
    </phrases>
    <options>
    </options>
    <helptopics>
    </helptopics>
    <cronentries>
    </cronentries>
    <faqentries>
    </faqentries>
</product>
I'll look into the vbseo thing again.

--------------- Added [DATE]1240808021[/DATE] at [TIME]1240808021[/TIME] ---------------

Just wanted to give you a heads up. Tested your code on a fresh install, non-vbseo. It always displayed all threads regardless of the letter clicked.
Reply With Quote
  #8  
Old 04-27-2009, 05:57 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This line is incorrect (PHP Tags "fix" it):
$vbulletin->input->clean_GPC('r', 'letter', 'TYPE_STR);

Change it to:
PHP Code:
$vbulletin->input->clean_GPC('r''letter'TYPE_STR); 
Also, you should be using the Admin CP to generate the XML - it will remove any structural errors.
Reply With Quote
  #9  
Old 04-27-2009, 11:20 AM
Dead Eddie's Avatar
Dead Eddie Dead Eddie is offline
 
Join Date: Apr 2004
Location: at Home...
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dismounted View Post
This line is incorrect:
PHP Code:
$vbulletin->input->clean_GPC('r''letter''TYPE_STR); 
Change it to:
PHP Code:
$vbulletin->input->clean_GPC('r''letter''TYPE_STR'); 
Also, you should be using the Admin CP to generate the XML - it will remove any structural errors.
Hm, I thought those TYPE_* were constants.

Quote:
Originally Posted by Chadi
Just wanted to give you a heads up. Tested your code on a fresh install, non-vbseo. It always displayed all threads regardless of the letter clicked.
You didn't make this change yet:

Quote:
Originally Posted by Myself
Also, change the hook location in the file you've released to forumdisplay_query_threadid. That might solve some people's problems.
If after making that change, you're still having problems, let me know. I should be able to install a test board today after work.
Reply With Quote
  #10  
Old 04-27-2009, 11:30 AM
Chadi's Avatar
Chadi Chadi is offline
 
Join Date: May 2004
Location: USA
Posts: 2,043
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks, that works now.

I have two issues now:

One, I'm trying to figure out the proper code replacement for "forum-path" so a person can copy/past this into forumdisplay template to use the mod globally, not per forum (as I currently have it linked directly to one specific forum).

Example:

http://www.talkjesus.com/scriptural-bible-answers/?letter=a"

That's the link for letter A.

What should be the vbseo replacement for the forum title/path which for me here is "scriptural-bible-answers"? My vbseo panel shows

[forum_title]

I tried that like this, it did not work.

Talk Jesus | Christian Forums & Chat - Powered by vBulletin[forum_title]/?letter=a"

I even added a $ before [forum and still does not work. Just redirects back to home page.

Second question is, I'd like to add a 0-9 # link as well, before the letter A table column.

Example:
Scriptural Bible Answers - Talk Jesus | Christian Forums & Chat

So I want a link like this:

"0-9"

The question is, how can I properly link it so it shows all threads in that forum that begin with any number? What would the link code look like for a singe link for "0-9" or better yet, just "#"?

Thanks!

--------------- Added [DATE]1240864909[/DATE] at [TIME]1240864909[/TIME] ---------------

Would appreciate if anyone can help me on this, thanks.

I'm trying to make the template versions to one version, vbseo or non-vbseo since vbseo changes it automatically.

Regarding 0-9 numbered threads listing:

I tried this, does not work, shows no threads but I do have one thread that begins with a letter, "144,000..."

Code:
<a rel="nofollow" href="http://www.talkjesus.com/scriptural-bible-answers/?letter=#">#</a>
Regarding the template code:

I'm using this in a test forum (fresh install) without vbseo
Code:
<table class="tborder" cellpadding="6" cellspacing="1" border="0" width="100%" align="center">
<td colspan="30" height="16" class="thead">
    <strong>Search topics by first letter</strong><tr align="center">
        <td class="alt1" width="3%">
        <a rel="nofollow" href="http://www.talkjesus.com/test/forumdisplay.php?f=$foruminfo[forumid]">All</a></td>    
        <td class="alt2" width="3%">
        <a rel="nofollow" href="http://www.talkjesus.com/test/forumdisplay.php?f=$foruminfo[forumid]&letter=a">A</a></td>
        <td class="alt1" style="padding:5px;text-align:center">
        <a rel="nofollow" href="http://www.talkjesus.com/test/forumdisplay.php?f=$foruminfo[forumid]&letter=b">B</a></td>
        <td class="alt2" width="3%">
        <a rel="nofollow" href="http://www.talkjesus.com/test/forumdisplay.php?f=$foruminfo[forumid]&letter=c">C</a></td>
        <td class="alt1" style="padding:5px;text-align:center">
        <a rel="nofollow" href="http://www.talkjesus.com/test/forumdisplay.php?f=$foruminfo[forumid]&letter=d">D</a></td>
        <td class="alt2" width="3%">
        <a rel="nofollow" href="http://www.talkjesus.com/test/forumdisplay.php?f=$foruminfo[forumid]&letter=e">E</a></td>
        <td class="alt1" style="padding:5px;text-align:center">
        <a rel="nofollow" href="http://www.talkjesus.com/test/forumdisplay.php?f=$foruminfo[forumid]&letter=f">F</a></td>
        <td class="alt2" width="3%">
        <a rel="nofollow" href="http://www.talkjesus.com/test/forumdisplay.php?f=$foruminfo[forumid]&letter=g">G</a></td>
        <td class="alt1" style="padding:5px;text-align:center">
        <a rel="nofollow" href="http://www.talkjesus.com/test/forumdisplay.php?f=$foruminfo[forumid]&letter=h">H</a></td>
        <td class="alt2" width="3%">
        <a rel="nofollow" href="http://www.talkjesus.com/test/forumdisplay.php?f=$foruminfo[forumid]&letter=i">I</a></td>
        <td class="alt1" style="padding:5px;text-align:center">
        <a rel="nofollow" href="http://www.talkjesus.com/test/forumdisplay.php?f=$foruminfo[forumid]&letter=j">J</a></td>
        <td class="alt2" width="3%">
        <a rel="nofollow" href="http://www.talkjesus.com/test/forumdisplay.php?f=$foruminfo[forumid]&letter=k">K</a></td>
        <td class="alt1" style="padding:5px;text-align:center">
        <a rel="nofollow" href="http://www.talkjesus.com/test/forumdisplay.php?f=$foruminfo[forumid]&letter=l">L</a></td>
        <td class="alt2" width="3%">
        <a rel="nofollow" href="http://www.talkjesus.com/test/forumdisplay.php?f=$foruminfo[forumid]&letter=m">M</a></td>
        <td class="alt1" style="padding:5px;text-align:center">
        <a rel="nofollow" href="http://www.talkjesus.com/test/forumdisplay.php?f=$foruminfo[forumid]&letter=n">N</a></td>
        <td class="alt2" width="3%">
        <a rel="nofollow" href="http://www.talkjesus.com/test/forumdisplay.php?f=$foruminfo[forumid]&letter=o">O</a></td>
        <td class="alt1" style="padding:5px;text-align:center">
        <a rel="nofollow" href="http://www.talkjesus.com/test/forumdisplay.php?f=$foruminfo[forumid]&letter=p">P</a></td>
        <td class="alt2" width="3%">
        <a rel="nofollow" href="http://www.talkjesus.com/test/forumdisplay.php?f=$foruminfo[forumid]&letter=q">Q</a></td>
        <td class="alt1" style="padding:5px;text-align:center">
        <a rel="nofollow" href="http://www.talkjesus.com/test/forumdisplay.php?f=$foruminfo[forumid]&letter=r">R</a></td>
        <td class="alt2" width="3%">
        <a rel="nofollow" href="http://www.talkjesus.com/test/forumdisplay.php?f=$foruminfo[forumid]&letter=s">S</a></td>
        <td class="alt1" style="padding:5px;text-align:center">
        <a rel="nofollow" href="http://www.talkjesus.com/test/forumdisplay.php?f=$foruminfo[forumid]&letter=t">T</a></td>
        <td class="alt2" width="3%">
        <a rel="nofollow" href="http://www.talkjesus.com/test/forumdisplay.php?f=$foruminfo[forumid]&letter=u">U</a></td>
        <td class="alt1" style="padding:5px;text-align:center">
        <a rel="nofollow" href="http://www.talkjesus.com/test/forumdisplay.php?f=$foruminfo[forumid]&letter=v">V</a></td>
        <td class="alt2" width="3%">
        <a rel="nofollow" href="http://www.talkjesus.com/test/forumdisplay.php?f=$foruminfo[forumid]&letter=y">Y</a></td>
        <td class="alt1" style="padding:5px;text-align:center">
        <a rel="nofollow" href="http://www.talkjesus.com/test/forumdisplay.php?f=$foruminfo[forumid]&letter=x">X</a></td>
        <td class="alt2" width="3%">
        <a rel="nofollow" href="http://www.talkjesus.com/test/forumdisplay.php?f=$foruminfo[forumid]&letter=y">Y</a></td>
        <td class="alt1" style="padding:5px;text-align:center">
        <a rel="nofollow" href="http://www.talkjesus.com/test/forumdisplay.php?f=$foruminfo[forumid]&letter=Z">Z</a></td>
    </tr>
</table>
<br />
I tried the same code above in my default install with vbseo enabled, does not work. Says invalid links.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:17 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.07695 seconds
  • Memory Usage 2,303KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_code
  • (4)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete