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 02-13-2009, 07:51 PM
Vaupell's Avatar
Vaupell Vaupell is offline
 
Join Date: Apr 2008
Location: Esbjerg, Denmark
Posts: 1,036
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default SOLVED! - starting help, using php <-> templates <-> db

Got the easy part down, find it easy to work in the control panel enviroment,
but displaying, modifying and editing content back and forth from db.

But now i want to work with user end app's.
I sorta got it narrowed down how to move around inside a php
file using do, get and request. almost like cp area.

and i got vb styled pages working, using header,footer etc.

Let me put up an exsample.

i have some content in the db, i want to show a user.

the user clicks some botton etc and gets to the point where the
content should be shown in the php file,,

So my question is how do i get the php file and templates to work together ?
i can get content from the db using the php file correct ?
and i style the user view with the template correct ?

so the datamovement would go like this db-> php file -> template -> user view
or am i way off.

any articles on this, or suggestions where i can get more info on this
specifik topic. ?
Reply With Quote
  #2  
Old 02-13-2009, 08:02 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In the php file, you eval the template to get it to show. You might want to look at this article - [How-To] vBulletin API Basics: Creating Custom Pages & Misc. That might help you out some.
Reply With Quote
  #3  
Old 02-14-2009, 05:14 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You may also want to look at the many other articles that could help you.
Reply With Quote
  #4  
Old 02-14-2009, 09:33 AM
Vaupell's Avatar
Vaupell Vaupell is offline
 
Join Date: Apr 2008
Location: Esbjerg, Denmark
Posts: 1,036
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

tx lynne, sorta missed that one.

really hard with 0 experience, but i guess only one way to learn
Reply With Quote
  #5  
Old 02-14-2009, 04:09 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Vaupell View Post
tx lynne, sorta missed that one.

really hard with 0 experience, but i guess only one way to learn
I learned by doing lots of reading! Oh, and playing on my test site.
Reply With Quote
  #6  
Old 02-14-2009, 04:58 PM
Vaupell's Avatar
Vaupell Vaupell is offline
 
Join Date: Apr 2008
Location: Esbjerg, Denmark
Posts: 1,036
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

well okay went through that article, and nothing "new" here.

got all that narrowed down.

mypage.php
mypage_content (template)

Exsample in the db i make a table named .table_prefix."testtable
with 2 colums ID(auto,primary) testcontent(text)

with the content =
ID 1 : line 1
ID 2 : line 2
etc.....

---------------------------here we go the hard part (for me)

I want to display display content from the table lwhere id = 2--

i make my sql query etc.. ...
but where do i make the query, do i make it inside the template ?
or do i make it in the .php file ?

i got my table's in the the template but when i try to run
a query in the templates it just bugs.

i can run querys in the php but cant make it fit into the tables
i import/read from the templates.. hehe lol

confusing, i hope you know what i mean, and what im trying to achive.
i donot have anything to display,
just doing alot of test pages, which i usually delete when they mess to
much up..



EDIT :

- Got php pages and creating vb powered pages
- Got using the querys in vb
- Got using templates.

But mixing it together.. ehhh.. im lost.
Reply With Quote
  #7  
Old 02-14-2009, 05:08 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Queries go in the php page - mypage.php - before you eval the template.
Reply With Quote
  #8  
Old 02-14-2009, 05:18 PM
Vaupell's Avatar
Vaupell Vaupell is offline
 
Join Date: Apr 2008
Location: Esbjerg, Denmark
Posts: 1,036
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
Queries go in the php page - mypage.php - before you eval the template.
allright thank you..

eksample i then do a query

----------template page---------

<table......
.....some content, phrases... . etc
<tr> <td>$test</td></tr>
</tr>
</table>
------------------------------------
?
?
?
-----------php page-----

$test = querystring........

eval template

----------------------------


did i understand it correctly ?

EDIT ADD :

saw this post https://vborg.vbsupport.ru/showthread.php?t=205362
and think i got it right time for some tests.
Reply With Quote
  #9  
Old 02-14-2009, 05:57 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I wrote a fairly simple mod that does a query and then spits out some stuff on vb like page. It has two templates with it. You may want to take a look at it. It's here - View all your social group messages. It may help you with figuring out how to do what you want.
Reply With Quote
  #10  
Old 02-14-2009, 07:06 PM
Vaupell's Avatar
Vaupell Vaupell is offline
 
Join Date: Apr 2008
Location: Esbjerg, Denmark
Posts: 1,036
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ahh yes, then i got it right..

then its the evel thats bugging me...

Php page named "Test.php" in forumroot
PHP Code:
// ####################################################################### 
// ######################## START MAIN SCRIPT ############################ 
// ####################################################################### 

if (!isset($vbulletin->userinfo['userid']) OR $vbulletin->userinfo['userid'] == 0)
{
        
print_no_permission(); 
}

if (empty(
$_REQUEST['do']))
{
        
$_REQUEST['do'] = 'main';
}
if (
$_REQUEST['do'] == 'main')
{

$navbits = array(); 
$navbits[$parent] = 'Test Page A'

$navbits construct_navbits($navbits); 
eval(
'$navbar = "' fetch_template('navbar') . '";'); 

$testmessage $vbulletin->db->query_read_slave("
                             SELECT evireviewpost.RID as RID, evireviewpost.Rtitle as Title, 
                             evireviewpost.Rdesc as BESK, evireviewpost.Rscore as Score, 
                             evireviewpost.Ruid as user, evireviewpost.Rlink as link
                             FROM " 
TABLE_PREFIX "evireviewpost as evireviewpost
                             WHERE  evireviewpost.RID = 1
                             "
);
                             
                        
//     eval('print_output("' . fetch_template('test_testa') . '");'); 
                             
eval('$testmessage.= "' fetch_template('test_testa') .'";');
                        
//   eval('$messagebits .= "' . fetch_template('socialgroups_messagelistbits') .'";');


and my template named "test_testa"

Code:
$stylevar[htmldoctype]
<html xmlns="http://www.w3.org/1999/xhtml" dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
$headinclude
<title>Test</title>
</head>
<body>
$header
<if condition="$navbar">$navbar<else /><br /><br /></if>


<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
	<td class="tcat">$testmessage[Title]</td>
</tr><tr>
<td> $testmessage[RID] - $testmessage[BESK]</td>
</tr><tr>
<td> normal text </td>

	</div>
	</td>
</tr>
</table>


$footer

</body>
</html>
and a screenshot of the database content..

Attachment 94884

when using Print output eval works fine, when using $testmessage just says
error at random lines in eval()_line x

this is my only current barrier for some modding

---- EDIT found the ) and replaced with ; in the end of Eval line,
howewer instead of an error a blank page? wth..
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 12:41 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.04238 seconds
  • Memory Usage 2,291KB
  • Queries Executed 14 (?)
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
  • (1)bbcode_code
  • (1)bbcode_php
  • (2)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_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