vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   WebTemplates 3.x: VB Integrated Content Management System (https://vborg.vbsupport.ru/showthread.php?t=76422)

Robert Basil 04-14-2005 12:07 PM

Quote:

Originally Posted by Logician
ok let's change the query like this:

SELECT t.threadid, t.title, t.firstpostid, t.lastpost, f.title as forumtitle, t.replycount, t.postusername, t.postuserid, t.lastposter, t.dateline, t.views, p.pagetext
FROM thread t
LEFT JOIN post p ON p.postid = t.firstpostid
LEFT JOIN forum f ON f.forumid = t.forumid
WHERE t.forumid
IN ( 108, 109 )
AND t.open = '1'
AND t.visible = '1'
ORDER BY t.dateline DESC
LIMIT 0 , 10

now $WQfield[title] gives you thread title and $WQfield[forumtitle] gives you forum title. ;)

You have a typo above.

LEFT JOIN forum f ON f.forumid = t.forumidpostid

Should be:

LEFT JOIN forum f ON f.forumid = t.forumid

After fixing the typo it works great, thanks!

Robert Basil 04-14-2005 12:13 PM

Here is how I am using your script. Everything on the page is pulled from the database using your script (except for the racing map)

http://www.pocketbikeplanet.com/view.php?pg=racing

I'm also using it for other areas of the site as well.

I've been a VB admin for over 4 years now and this is by far my favorite script. :)

P.S. To others using this script, please don't send me PM's or Email's for help. Post you questions in this thread and I'll try and help.

Spinball 04-14-2005 01:57 PM

Quote:

Originally Posted by Logician
I don't get your problem exactly. All I'm saying is that IF your webtemplate is "PHP parsed" you can NOT include any header and footer in it, otherwise you'd get PARSE error. (This is also stated in help document). Headers and footers are for "TEXT" or "HTML" parsed webtemplates.

If your webtemplate is already TEXT or HTML parsed but you still get an parse error, then paste the content of your header and webtemplate that gives the error and I'll check.

So how do you get the header and footer displayed on a page if the template is PHP?
I have created a template which does a standard search of a database and displays the results. Problem is that there is no header and footer like there is with HTML pages.

Robert Basil 04-14-2005 07:50 PM

How do I tell the code below to show the last 3 posts from each forum and sort them by forum?

This is what I have so far...

SELECT t.threadid, t.title, t.firstpostid, t.lastpost, f.title as forumtitle, t.replycount, t.postusername, t.postuserid, t.lastposter, t.dateline, t.views, p.pagetext, t.iconid, t.forumid
FROM thread t
LEFT JOIN post p ON p.postid = t.firstpostid
LEFT JOIN forum f ON f.forumid = t.forumid
WHERE t.forumid
IN ( 19, 116 )
AND t.open = '1'
AND t.visible = '1'
ORDER BY forumtitle DESC
LIMIT 0 , 3

Robert Basil 04-15-2005 10:54 PM

Just an update on my progress...

I tried using the code:

SELECT t.threadid, t.title, t.firstpostid, t.lastpost, f.title as forumtitle, t.replycount, t.postusername, t.postuserid, t.lastposter, t.dateline, t.views, p.pagetext, t.iconid, t.forumid
FROM thread t
LEFT JOIN post p ON p.postid = t.firstpostid
LEFT JOIN forum f ON f.forumid = t.forumid
WHERE t.forumid
IN ( 19, 116 )
AND t.open = '1'
AND t.visible = '1'
GROUP BY f.title
ORDER BY forumtitle DESC
LIMIT 0 , 3

The code above does two things that confuse me. (Keep in mind I am a very novice mySQL guy, so I am easily confused) ;)

#1. It only grabs one thread from each forum. (2 threads total on the page even though the limit is set to 3)

#2. The thread that it grabs is the oldest thread, not the newest one.

I've tried so many different query's I'm about ready to pull my hair out. Any ideas Logician??

Marco van Herwaarden 04-16-2005 06:33 AM

This is an extreme difficult thing to do in just 1 query. I have seen your other post about this also, but didn't have a brainwave for a solution yet. Maybe when i wake up. :D

Spinball 04-16-2005 09:04 AM

You're only getting two rows in your result because your are grouping by forum and you are selecting from 2 forums.
I don't have a quick solution either. But I would start looking at nested selects, maybe.

Robert Basil 04-16-2005 10:00 AM

Quote:

Originally Posted by MarcoH64
This is an extreme difficult thing to do in just 1 query. I have seen your other post about this also, but didn't have a brainwave for a solution yet. Maybe when i wake up. :D

Any help you can provide would be great! Thanks!

Robert Basil 04-16-2005 10:02 AM

Quote:

Originally Posted by Spinball
You're only getting two rows in your result because your are grouping by forum and you are selecting from 2 forums.
I don't have a quick solution either. But I would start looking at nested selects, maybe.

Well, you lost me as soon as you said "nested selects". ;)

I admit I'm way over my head here with mySQL query syntax knowledge.

Spinball 04-17-2005 11:39 AM

Quote:

Originally Posted by Sportbikeworld
Well, you lost me as soon as you said "nested selects". ;)

I admit I'm way over my head here with mySQL query syntax knowledge.

Short term visit the MySQL website, longer term, buy a book. Or go on a course. I have been fortunate enough to have been sent on about 3 SQL courses at Oracle in Reading (UK) by my previous employer and if you make money from your board then taking the time/money to amass some SQL knowledge will be a worthwhile investment.

Logician - any help on my question above, please?


All times are GMT. The time now is 09:42 AM.

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.01429 seconds
  • Memory Usage 1,746KB
  • 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
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (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