vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   [WEBTEMPLATES HACK:]Share your WebTemplates or WebQueries! (https://vborg.vbsupport.ru/showthread.php?t=36578)

mbaskett 07-26-2002 05:30 PM

Just a quickie here...

I got the new version up and started some basics of config and whatnot... Of course I re-edited the show.php to use the vb header and footer templates, as well as working with our PHPAdsNew implementation.

First impressions:

Like the new adminCP setup. Having a seperate file is a bit nicer. I *think* I did the upgrade steps properly, btu was a bit unclear if I should have removed the webqueries code from tempate.php or if it was just the webtemplates code....

I did a small bit of tweaking of webtemplate.php so that the layout in the adminCP is a bit clearer. Most of it was because all our webtemplates are ordered based on their name, which we use for organization and sorting, etc.

The code below also keeps a small bit of code from being repreated.. I know it's minor, but it can play a role on page load time when you are listing MANY templates....

PHP Code:

// ###################### Start weblist #######################
if ($action=="weblist") {

echo 
'<table width="100%" border="1" cellspacing="0" cellpadding="0"><tr><td style="BACKGROUND-COLOR: #cecfce; border: 2px outset; padding-left: 3px; FONT-FAMILY: Verdana, MS Sans Serif; FONT-SIZE: 11px; text-align: center;"><div align="center"><font size="4"><b>Your Existing Web Templates:</b></font></div></td></tr><tr><td>';
echo 
'<table width="100%" border="0" cellspacing="0" cellpadding="0">';
 
$log_webtitles=$DB_site->query("SELECT templateid, title,count FROM webtemplates ORDER BY title"); 
  while (
$tumsatir=mysql_fetch_row($log_webtitles)) 
     {
     
$iii++;  if ($iii%2==0) {$tbbgcolor='#F1F1F1';} else {$tbbgcolor='#DFDFDF';}
     echo 
'<tr bgcolor="'.$tbbgcolor.'"><td width="30" align="right">';
     echo 
"$iii- </td><td align=left><b>$tumsatir[1]</b></td><td> - $tumsatir[2] visits ".     makelinkcode("edit","webtemplate.php?s=$session[sessionhash]&action=webedit&templateid=$tumsatir[0]").
     
makelinkcode("remove","webtemplate.php?s=$session[sessionhash]&action=webremove&templateid=$tumsatir[0]").
      
makelinkcode("visit","$bburl/show.php?s=$session[sessionhash]&pg=$tumsatir[1]").
     
makelinkcode("download","webtemplate.php?s=$session[sessionhash]&action=webtemplatedownload&templateid=$tumsatir[0]")."\n";
     echo 
'</td></tr>';
    }
echo 
'</table>';
echo 
'<tr><td>[<a href="webtemplate.php?s='.$session[sessionhash].'&action=webadd">Add a New WebTemplate<a/>]</td></tr>';        
echo 
'<tr><td style="BACKGROUND-COLOR: #cecfce; border: 2px outset; padding-left: 3px; FONT-FAMILY: Verdana, MS Sans Serif; FONT-SIZE: 11px; text-align: center;"><b>WebTemplates & WebQuery Hack</b> by <i>Logician</i>  \\\\=^))</tr></td>';
echo 
'<tr><td><div align="center"><small><a href="'.$webtemplates_helpurl.'" target="_blank">WebTemplates Help Page - <a href="'.$webqueries_helpurl.'" target="_blank">WebQueries Help Page</a> - <a href="https://vborg.vbsupport.ru/showthread.php?s=&threadid=36419" target="_blank">Vbulletin.org Thread</a> - <a href="https://vborg.vbsupport.ru/showthread.php?s=&threadid=36578" target="_blank">Share Your WebQueries</a></div></td></tr></table>';
echo 
'<li><small>"notallowed" template is loaded, if visitor tries to access an unallowed page and "notfound" template is shown, if the requested page does not exist.</small></li>';



//if ($action=="weblist") 


Logician 07-29-2002 07:07 AM

Quote:

Originally posted by mbaskett
was a bit unclear if I should have removed the webqueries code from tempate.php

It's not important. After the upgrade, hack codes in template.php become obsolete and will not be used again. So best practise is to delete them, but if you dont, its no big deal, they are harmless in there..

Quote:

I did a small bit of tweaking of webtemplate.php so that the layout in the adminCP is a bit clearer. Most of it was because all our webtemplates are ordered based on their name, which we use for organization and sorting, etc.
So you changed sort order?

mbaskett 07-30-2002 07:57 PM

Quote:

Originally posted by Logician

It's not important. After the upgrade, hack codes in template.php become obsolete and will not be used again. So best practise is to delete them, but if you dont, its no big deal, they are harmless in there..

Fair enough ;)


Quote:

So you changed sort order?
I don't believe the order itself was changed, just the formatting. Removed a <table> tag that was being looped through for coding sake (basically each template in the list was showing up in own table. While it was not visually noticable, the simple creation of the table,tr,td, /td,/tr,/table tags for EACH template in the list was inefficient... so instead I changed it to one table with the tr,td,/td,/tr tags being looped through.

I've also added one addition function to the hack as of now... a description field. We plan on using this for menu population (as our template names are probably not visually appealling to see in auto-populated menus....) more on this later once it's all completed and in the testing phases.

Rose 07-30-2002 08:05 PM

I installed this a day or three ago. Love it so far! (I posted in the hack thread regarding some specific questions).


I just added Wild Thinks query/last ten threads and modified it abit. :D Works nice. However, I'm interested in this "new version" that parses vbcode. Right now it shows the [ quote ] tags and such if they are at the beginning of the post.


edited to add - Is there anyway to NOT show posts in private forums on the site's "last ten posts"? I don't want links to the moderator's lounge popping up (granted, mebmers can't get in, but let's not flaunt it!).

Any ideas? Query modifications?

Rose 07-30-2002 08:58 PM

Also, on my site I have the "Welcome back, Username" here. For unregistered members/guests - how would I include a login panel for them?

Logician 07-31-2002 07:42 AM

Rose,
Quote:

Originally posted by Rose
I just added Wild Thinks query/last ten threads and modified it abit. :D Works nice. However, I'm interested in this "new version" that parses vbcode. Right now it shows the [ quote ] tags and such if they are at the beginning of the post.

The new version is in progress.. In fact I sent them to some power users so that they can return me comments and it's proved to be working ok. But I cant guarantee it has no bugs at the moment and I cant support it until I release it. So if this is not a problem for you and want to test it out, drop me your mail address and I'll send it to you. If you want to have the "stable" and "final" version, you have to wait until it's released..
Quote:

edited to add - Is there anyway to NOT show posts in private forums on the site's "last ten posts"?
Sure you have to modify Wildthinks query a bit: Replace XXX, YYY and ZZZ with forumids in the query below to exclude these forums:

SELECT thread.title as threadname, thread.threadid, thread.forumid, from_unixtime(post.dateline,'%d.%m.%Y - %H:%i:%s') as dd, left(post.pagetext,80) as pagetxt, post.username, post.userid, forum.forumid, forum.title FROM thread,post,forum where post.threadid=thread.threadid and thread.forumid=forum.forumid and thread.forumid<>XXX and thread.forumid<>YYY and thread.forumid<>ZZZ order by post.dateline desc limit 10

Quote:

Also, on my site I have the "Welcome back, Username" here. For unregistered members/guests - how would I include a login panel for them?
You can use a "conditional" like this:
[[($bbusergroupid==1)]]
Copy paste the login form's HTML code here.
[[/($bbusergroupid==1)]]

It's like the hidden text in my sample webtemplate. If the user is unregistered/unloggedin, this conditional will be parsed and he'll get the code in between. If he is a loggedin member, he wont see that part in the webtemplate.. ;)

Rose 07-31-2002 02:07 PM

Thank you, Logician! I've changed the query so that my private forums info stays private. :D

But I'm still having trouble using the login form. DkrFusion gave me the code to have it say Welcome Back "so and so" - but even when I'm logged in I see "Unregistered". Logged into the forums, anyway. I can't seem to ever be "logged into" the site - yet I can't logout and see the login box what I put in according to your instructions. Any ideas? *hehe*

Logician 07-31-2002 02:18 PM

Quote:

Originally posted by Rose
But I'm still having trouble using the login form. DkrFusion gave me the code to have it say Welcome Back "so and so" - but even when I'm logged in I see "Unregistered". Logged into the forums, anyway. I can't seem to ever be "logged into" the site - yet I can't logout and see the login box what I put in according to your instructions. Any ideas? *hehe*
I think I didnt get it right? Can you please post the webtemplate (or the relevant part) that you are talking about. And clarification on what exactly you are trying to achieve on this webtemplate can also help.. :knockedout:

Rose 07-31-2002 02:30 PM

Quote:

Originally posted by Logician

I think I didnt get it right? Can you please post the webtemplate (or the relevant part) that you are talking about. And clarification on what exactly you are trying to achieve on this webtemplate can also help.. :knockedout:

*hehe* Sure - here's what I'm doing. On the index page of the site, I want it to welcome back each member by name - or if they aren't logged in or registered - a login box would be provided.


Here's the code I'm working with - it may be off, but it's what I got:


(quoted in php because.....I thought it'd be better that way?)

PHP Code:

<!-- Left Column Body Start -->
<
td valign="top" width="200"><table bgcolor="#F6EDCA" cellpadding=5 cellspacing="1"><tr width=100height=100%><td background="http://www.thesistersthree.com/site/headerbg.jpg" align=center>
<
font face=verdana color="#FBF5E1" size=1><b>Welcome Back $user_username</b></font></td></tr>
<
tr><td bgcolor=#330000">
[[($bbusergroupid==1)]]
<
form action="member.php" method="post">
<
tr>
    <
td nowrap><smallfont><b>Not cookied?</b><br>Login with username and password:</smallfont></td>
</
tr><tr>
    <
td nowrap><input type="hidden" name="s" value="$session[sessionhash]">
    <
input type="hidden" name="action" value="login">
    <
input type="text" class="bginput" name="username" size="7">
    <
input type="password" class="bginput" name="password" size="7">
    <
input type="submit" class="bginput" value="Login!"></td>
</
tr>
</
form>

[[/(
$bbusergroupid==1)]]</td></tr>

<
tr>
<
td bgcolor="#330000"><font face=verdana color="#FBF5E1" size=1>
<
a href="http://www.thesistersthree.com/forums/usercp.php?"><center><b>My Control Panel</b></center></a><br


Logician 07-31-2002 07:12 PM

Quote:

Originally posted by Rose

*hehe* Sure - here's what I'm doing. On the index page of the site, I want it to welcome back each member by name - or if they aren't logged in or registered - a login box would be provided.

ok I see your problem: Use conditional in this format:

[[($bbuserinfo[usergroupid]==1)]]

Of course closing conditional will be replaced too:
[[/($bbuserinfo[usergroupid]==1)]]


All times are GMT. The time now is 04:36 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.01551 seconds
  • Memory Usage 1,813KB
  • 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
  • (2)bbcode_php_printable
  • (10)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)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