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)

silly rabbit 02-24-2006 01:35 PM

Quote:

Originally Posted by Logician
Webtemplates still has a structure for creating such special variables and templates but it is for advanced users only. People who is proficient in PHP can check vbulletin's algorithm for such special variables . . .

Logician, I see your 'share' thread survives!! Am studying / using your WT system and don't have any real problems(yet) but would value your opinion. Do you see any conflicts or problems with integrating WT with Abe's FORMS HACK ??? One is great at DB reading (yours) and the other is suited to DB / thread writing and although I certainly have more research & learning to do I'm will try to combine the two.

Also, I'm trying to migrate away from the 'td' (table data) and FRAMING system and am using Css for both 'style' and layout formatting thru the use of 'href' and 'import'. As far as positioning is concerned Percent works well but 'absolute' is so so . . .

Any gENERAL Thoughts / Tips to Share??

leitel 02-24-2006 01:47 PM

I also needed a means to manage vb and non-vb data from within vb. I looked at forms hack. It looks adequate for simple needs. I needed more. Then 're-discovered' CodeCharge . With a little hacking you can embed the code 'within' vb pages!!

Logician 02-24-2006 01:53 PM

Quote:

Originally Posted by silly rabbit
Logician, I see your 'share' thread survives!! Am studying / using your WT system and don't have any real problems(yet) but would value your opinion. Do you see any conflicts or problems with integrating WT with Abe's FORMS HACK ??? One is great at DB reading (yours) and the other is suited to DB / thread writing and although I certainly have more research & learning to do I'm will try to combine the two.

Also, I'm trying to migrate away from the 'td' (table data) and FRAMING system and am using Css for both 'style' and layout formatting thru the use of 'href' and 'import'. As far as positioning is concerned Percent works well but 'absolute' is so so . . .

Any gENERAL Thoughts / Tips to Share??

Sorry I have no idea, I have never used that hack.

silly rabbit 02-24-2006 08:59 PM

Quote:

Originally Posted by Logician
Sorry I have no idea, I have never used that hack.

Quote:

Originally Posted by leitel
Then 're-discovered' CodeCharge . With a little hacking you can embed the code 'within' vb pages!!

Great job nonetheless Logician - will report back 'results'!!

Can I parse in HTML and still embed php????

Oh, never knew href file addressing to be Case Sensitive!!!! ('lil things do drive ya nuts!)[/COLOR][/SIZE]

Quote:

Originally Posted by added
I see CodeCharge - if it generates pages via 'td' with styling 'inline' it's really not much use to me as I need to develop and control my own HTML within Css. Am currently using Studio5 from UltraEdit.com (costs less) having also tried Zends Studio 5 which is geared more for local server side (not hosts). BOTH support ALL scripting languages including PHP and Css thru easy FTP access.

Css Is Great!!!

Holy Cow, I LIKE the editors 'color' selector!!! (also a hack to investigate?) I'd like to see it in HEX values!!!

Cheers!!

geezmo 04-10-2006 07:46 AM

Hi! How do I make a webquery that pulls a post posted fromma certain forum and makes it a separate WebTemplate page?

Sort of an article system, where I make a new thread in say Forum 1 and that new thread becomes a new article page in WebTemplate? So that if I made 10 new threads in Forum 1, I can have 10 different WebTemplate pages corresponding to each of those new threads? Also I don't want it to be a simple link to the post in the forum but a stand-alone article itself.

Hmm.. exactly like this: http://www.theadminzone.com/forums/a...icle&aid=18141

bada_bing 04-12-2006 03:22 AM

Lets see more webQueries and your code. This thread would be cool of we can make this a total "post your WebTemplates and WebQueries for others to see and use.

I currently have WebTemplates installed and I know there is tons of potentials with this hack but me not being a coder I would like to get some ideas of how your using this hack and details on how you created it.

Logician 04-12-2006 07:02 AM

Quote:

Originally Posted by bada_bing
Lets see more webQueries and your code. This thread would be cool of we can make this a total "post your WebTemplates and WebQueries for others to see and use.

I currently have WebTemplates installed and I know there is tons of potentials with this hack but me not being a coder I would like to get some ideas of how your using this hack and details on how you created it.

I agree with you and the goal of this thread was actually this but I'm afraid hack users are not interested in sharing their WT/WQ much. :knockedout:

Actually import/export WT section is only designed so that people can easily share their work but unless they do, there is not much I can do. Unfortunately I don't have time to create new WT/WQ so it would be really great if hack users take the liberty and help eachother. :cool:

bada_bing 04-12-2006 05:38 PM

Quote:

Originally Posted by Logician
This WebQuery will display the last XX private messages of your members. So if you want to keep your member's pms under surveillance, you'll like this one ;)

Here we go: Login your CP and click ADD QUERY:
Fill the form accordingly:

QUERY NAME:
----------------
_privatemessages

QUERY:
---------
SELECT privatemessageid, fromuserid, touserid, title, message, touser.username AS tousername, fromuser.username AS fromusername
FROM privatemessage
LEFT JOIN user AS touser ON (touser.userid=privatemessage.touserid)
LEFT JOIN user AS fromuser ON (fromuser.userid=privatemessage.fromuserid)
WHERE folderid='0'
ORDER BY privatemessageid DESC LIMIT 30

(Change 30 to whatever you want for last XX messages)

DESCRIPTION:
-------------------
Read last XX private messages of your forum.

NO RESULT TEXT:
----------------------
No private messages exist in the database!

TABLE ROW:
---------------------
<table width="100%" border="0" cellspacing="1" cellpadding="1" bgcolor="#0000FF"><tr><td><table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF"><tr> <td ><div align="center"><normalfont>Message
ID: ??privatemessageid??</normalfont></div>
</td><td ><div align="center"><normalfont><a href="$bburl/member.php?s=&action=getinfo&userid=??fromuserid?? ">??fromusername??</a></normalfont></div>
</td><td ><div align="center"><normalfont><a href="$bburl/member.php?s=&action=getinfo&userid=??touserid??"> ??tousername??</a></normalfont></div></td></tr><tr>
<td colspan="3" ><normalfont>??title??</normalfont></td></tr><tr>
<td colspan="3" ><normalfont>??message??</normalfont></td></tr></table></td></tr></table>


Save your query and it's ready to rock. Now let's add a Webtemplate to attach your query:

Click ADD WEBTEMPLATE and create your HTML page as you like. Just a few points about your webtemplate:
1- Insert $_privatemessages in your template in the place where you want the private messages displayed.
2- Insert [options]templatequeryon[/options] anywhere in your template so that the script will parse your WebQuery.
3- Dont forget to ban this page to your ordinary users so that other members wont see all pms of all users. Give access to specific users/usergroups for this page. Eg. insert :

[cantsee]everybody[/cantsee][cansee]6 Admin[/cansee]

This will ban the template to all users except whose usergroup id is 6 or username is "Admin"

Just a WebTemplate Sample here:
(Remember WebTemplates are simple HTML pages so you can create them by yourself, this is just an example)
-- cut ----
[cantsee]everybody[/cantsee][cansee]6 Admin[/cansee] [options]templatequeryon[/options]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head>
<!-- no cache headers -->
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="no-cache">
<meta http-equiv="Expires" content="-1">
<meta http-equiv="Cache-Control" content="no-cache">
<!-- end no cache headers -->
<title>$bbtitle </title>
<p align="left">$headinclude </head> <body> $header <br><p>

<p align="left"> <normal></normal></p>
<table width="100%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td valign="top">
<p align="center"><smallfont>The page you accessed is visited by '$count' times.
Last visitor of this page was "$lastvisitorname" who visited the page at $lastvisittime.</smallfont></p>
<p>&nbsp;</p>
<div align="left">
<table cellpadding="4" cellspacing="1" border="0" width="100%">
<tr id="cat">
<td bgcolor="#606096"><normalfont color="#FFF788"><b>Last
30 Private Messages From Your Board:</b></normalfont></td>
</tr>
<tr>
<td bgcolor="#F1F1F1">
<p><normalfont> </normalfont><normalfont>$_privatemessages<br>
</normalfont></p>
</td>
</tr>
</table>
<p align="center"><smallfont></smallfont></p>
</div>
</td>
</tr>
</table>
$footer
-- cut --------

That's all! Now you can call your webtemplate as http://your_board_url/show.php?pg=your_template_name to monitor last XX pms in your board. ;)

Enjoy!
Logician

I am trying to run a query but admincp is giving me this message

You are not authorized to execute SQL queries

I am logged in as Administrator???

bada_bing 06-16-2006 02:49 PM

Any update to this thread? Lets keep it alive and post your code and what you are using this hack for.

Ntfu2 06-16-2006 03:07 PM

Quote:

Originally Posted by bada_bing
I am trying to run a query but admincp is giving me this message

You are not authorized to execute SQL queries

I am logged in as Administrator???


In the config.php there is a place to add your member id number to the users that can run queriers.

Make sure your number is there :)

ChrisBaktis 08-11-2006 03:03 AM

Any help with the webquery to list the top to referers and how many referals they have?

louis_chypher 08-15-2006 10:46 AM

Any suggestion on how to pass a parameter to a web querry and have it included in the query? Such as an event id.

such as:

SELECT something FROM calendar where id=xxxx

where I pass to the query the value for xxxx?

Also:

Quote:

Originally Posted by ChrisBaktis
Any help with the webquery to list the top to referers and how many referals they have?


I am assuming by, "to list the top to referers" you mean the top two (2) referers?

Try in your admin Maintainence sql query (see note):

SELECT COUNT(2) AS count, user.userid AS userid
FROM XXXuser AS users
INNER JOIN XXXuser AS user ON(users.referrerid = user.userid)
WHERE users.referrerid <> 0
GROUP BY users.referrerid


*NOTE: replace XXX with the prefix name that you are using for you dB.

The prefix name I use is "vb_" so the query I would use is:

SELECT COUNT(2) AS count, user.userid AS userid
FROM vb_user AS users
INNER JOIN vb_user AS user ON(users.referrerid = user.userid)
WHERE users.referrerid <> 0
GROUP BY users.referrerid

If you do not have a prefix then use:

SELECT COUNT(2) AS count, user.userid AS userid
FROM user AS users
INNER JOIN user AS user ON(users.referrerid = user.userid)
WHERE users.referrerid <> 0
GROUP BY users.referrerid

******************
if that is what you want then the below should work in your web query as the query to get the count and who:

SELECT COUNT(2) AS count, user.userid AS userid
FROM " . TABLE_PREFIX . "user AS users
INNER JOIN " . TABLE_PREFIX . "user AS user ON(users.referrerid = user.userid)
WHERE users.referrerid <> 0
GROUP BY users.referrerid

Logician 08-16-2006 09:49 PM

Quote:

Originally Posted by louis_chypher
Any suggestion on how to pass a parameter to a web querry and have it included in the query? Such as an event id.

such as:

SELECT something FROM calendar where id=xxxx

where I pass to the query the value for xxxx?

Also:

You can use phpinclude part of webquery. Check priv_privatemessages wt for an example.

louis_chypher 08-18-2006 11:28 AM

Hopefully, I can explian this correctly.

Lets say I made a WebTemplate that is a 'template'; lets call it TemplateTemplate.

I would like to create a webtemplate page (to keep it simple) that allows for the entry of a name and submit button. When a name has been entered and the submit button is pressed the TemplateTemplate is used as a template to create a brand new web template that is named based upon the entred name.

Another try at an explination

I have a webtemplate named TemplateTemplate that is the base template to create other templates off of.

I have another web template that a user can go to, call it 'CreateTemplate'. CreateTemplate has a text field and a submit button. When the submit button is pressed on CreateTemplate, create template (calling what ever is needed) takes TemplateTemplate as a base to create a new web template that is named as was entered on CreateTemplate.

Is this possible?

What code or functions do I need to call to make a webtemplate from one web template?
Can there be be 'default settings' or a default template used to create other templates from?

If its not possilble then what would be needed to make it possible?

grazianno 09-20-2006 12:32 PM

hi,
i want use the recent attachment code with webtemplates to display the recent attachments

the recent attachment code is:

Code:

<------the code to add in index.php------>
$trix = $db->query("
SELECT attachmentid, dateline, filename
FROM attachment
WHERE dateline < " . TIME() ."
ORDER BY dateline DESC
LIMIT 5");

while ($recentattachment = $db->fetch_array($trix))
{
        eval('$latestattachments .= "' . fetch_template('recent_attachments') . '";');
}
<------/the code to add in index.php------>

<------the code to add in a new template "recent_attachments"------>
<tr>
<td class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" valign="top">
<td>
    <tr>
          <td width="30%"><a href="attachment.php? attachmentid=$recentattachment[attachmentid]">
<img src='attachment.php? attachmentid=$recentattachment[attachmentid]' alt='$recentattachment[filename]' width="50" height="50">
</a>
<br> Attachment number $recentattachment[attachmentid]
</td>
         
        </tr></td>
            </td>
  </tr>
</table>
<------/the code to add in a new template "recent_attachments"------>

<------the code to add in the forumhome template ------>
<table class="tcat" cellpadding="0" cellspacing="0" border="0" width="100%" align="center" valign="top">
<tr>
<td class="thead" width="100%">
<normalfont><b>Recent ATTachment</b></normalfont></td></tr>
<tr>
<td align="center">
$latestattachments
</td>
</tr>
</table>
<------/the code to add in the forumhome template ------>

i dont know where to add this code
Code:

while ($recentattachment = $db->fetch_array($trix))
{
eval('$latestattachments .= "' . fetch_template('recent_attachments') . '";');
}

if someone can help...
thx


All times are GMT. The time now is 01:16 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.01203 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_code_printable
  • (10)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (15)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