The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
create link to a forum using "title_clean" as tag?
hi, i'm new to vbull, new to php....
i am trying to define links to forums using title_clean as the identifier. (i believe this to be the only aplha unique field within table). can anyone please point me in the right direction... more info... what i really want is a link to a forum which coresponds to a specific vbad page. the idea being that the vbad page is the "entry point" for visitor, which then has a link to forum which coresponds to that page. i have created tables in mysql which have identical values for "pageid" and "title_clean". thanx in advance jfk --------------- Added [DATE]1210668489[/DATE] at [TIME]1210668489[/TIME] --------------- here is an example of what i trying to achieve... tho not correct!... the link must be defined by a variable (to enable multiple entries into db) $url/forums/forumdisplay.php?f=$foruminfo[title_clean=pageid] ... (title_clean and pageid have identical values in the db) or something like this |
#2
|
|||
|
|||
i see a lot of views to my post, but no replies which probably means i'm not asking the correct question.
here is what i want to do. i have created a list of vb_adv pages. i have created a list of vbul forums. both pages and forums are from the same list. i want to make a link from the "page" to the corresponding "forum" (and vice-versa) using $variable. i know which data i want to look up, but my problem is that i dont know the syntax. i would like vbull to look at the page it is currently displaying, using whatever $variable it used to create that page eg. sql_table "adv_pages"- field "title", then take this piece of data and go look in sql_table "forum"- field "title_clean", compare the data and return a match which then displays the relative forum. i guess i've made this a complicated question again .... sorry. |
#3
|
||||
|
||||
I think the best anyone can offer you is the following:
Use the following conditional in your forumdisplay template: Code:
<if condition="$forumid == X">Your ad here</if> Code:
<if condition="in_array($forumid, array(X,Y,Z))">Your ad here</if> More conditionals: http://www.vbulletin.com/forum/showthread.php?t=200894 |
#4
|
|||
|
|||
hello again, i'm back!
i am sure there are a number of ppl here who can solve this problem for me, if i can just attract their attention for a few mins. i am half way through my second year of vbull license, and still dont have a working forum. this must be a record! i am member of vbulletin (obviously), vbulletin.org, vbadvanced, and vbulletinsetup, and somehow i can't seem to ask the right question.... to get the right answer. i will try a different tack here, again! essentially, i want to "query the sql database". how hard can that be, u might ask? all over the world, vbull scripts must be "querying the database" a million times a second! the whole script "survives" on "querying the database". this is precisely why i have opted for vbull, BECAUSE it uses mysql! i am getting a little despondent, at this stage. i should by this time, be an expert in PHP, MYSQL, and any number of programming langs! ok, enough of waffle. why does this not work? Code:
$get_forumid = $db->query("SELECT forumid FROM " . TABLE_PREFIX . "forum WHERE title LIKE '$getpage'"); Code:
<a href="http://mysite.com/forums/forumdisplay.php?f="$get_forumid"> |
#5
|
|||
|
|||
You probably want to use $db->query_first() instead of $db->query().
also make sure that $getpage is cleaned before using it in the query. |
#6
|
|||
|
|||
Quote:
--------------- Added [DATE]1224954048[/DATE] at [TIME]1224954048[/TIME] --------------- here is an of what i have tried so far: here's where i up to.... inserted query here (in vba_cmps_include_top.php) Code:
// Figure out which page to grab $pagevar = $vba_options['portal_pagevar']; if (defined('VBA_PAGE')) { $getpage = VBA_PAGE; } else if(isset($_REQUEST[$pagevar])) { $getpage = $_REQUEST[$pagevar]; //jfk $get_forumid = $db->query("SELECT forumid FROM " . TABLE_PREFIX . "forum WHERE title LIKE '$getpage'"); //end jfk then i have inserted this link here (in navbar template) Code:
<!-- nav buttons bar --> <div class="tborder" style="padding:$stylevar[cellspacing]px; border-top-width:0px"> <table cellpadding="0" cellspacing="0" border="0" width="100%" align="center"> <tr align="center"> <!--######### jfk #############--> <td class="vbmenu_control"><a href="$vboptions[homeurl]">$vboptions[hometitle]</a></td> <td class="vbmenu_control"><a href="http://ntra.org.uk/forums/forumdisplay.php?f="$get_forumid">Forum</a></td> <!--######### end jfk ######### --> |
#7
|
|||
|
|||
PHP Code:
|
#8
|
|||
|
|||
Quote:
|
#9
|
|||
|
|||
What is the value of $get_forumid after the database call?
|
#10
|
|||
|
|||
Quote:
the "real" expected value would be as follows: if i submit (to db) a $pagetitle var which= "Stockport", for example... the query will find a forum which also has a "title" of Stockport, and this would have a "forumid" value of "395". (this is the actual entry in the db) |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|