Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #11  
Old 01-22-2005, 02:48 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try this
PHP Code:
$compiled_header_template str_replace(array('\\\\$''\\\''), array('\\$''\''), addslashes($templates['header'])); 
Haven't thought of using ' for tag arguments, as I always use "
Reply With Quote
  #12  
Old 01-22-2005, 02:54 PM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by TheMayhem
PHP Code:
<body bgcolor='#ffffff' leftmargin='0' topmargin='0' bottommargin='0' rightmargin='0'>
<
table cellpadding='0' cellspacing='0' border='0' class='maintable' width='650' align='center'>
<
tr>
<
td>LOGO GOES HERE</td>
</
tr>
<
tr>
<
td background='images/navbg.jpg' height='20'>LINKS</td>
</
tr>
<
tr>
<
td
This is the header template that doesnt even call upon any arrays. I have it after all the php code at the bottom of the page right before the last } ?> and even this one will not cooperate
Your problem is bad html... nothing more

in HTML all attribute varibles should be nested inside of DOUBLE quotes, not SINGLE


HTML Code:
 <body bgcolor="#ffffff" leftmargin="0" topmargin="0" bottommargin="0" rightmargin="0"> 
<table cellpadding="0" cellspacing="0" border="0" class="maintable" width="650" align="center"> 
<tr> 
<td>LOGO GOES HERE</td> 
</tr> 
<tr> 
<td background="images/navbg.jpg" height="20">LINKS</td> 
</tr> 
<tr> 
<td> 
Reply With Quote
  #13  
Old 01-22-2005, 03:57 PM
TheMayhem's Avatar
TheMayhem TheMayhem is offline
 
Join Date: Oct 2002
Location: Pittsburgh, Pa
Posts: 526
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmmm I figured if I used " then php could get an error... guess not. My last question is now for my news I want to display a loop statement, which I use a while. Now I know this won't work correctly because I'm using a mysql_fetch_array query inside a while statement and it is going to loop the number of times I have an entree in the db. So how exactly could I take a while statement that is going to loop and actually store the information in the template so it shows each and every loop, such as $news[news_name] should loop 8 times and thus loops 8 times in the template and shoes each array being different then the last?
Reply With Quote
  #14  
Old 01-22-2005, 04:02 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've read this 3 times now and still don't understand your problem
Reply With Quote
  #15  
Old 01-22-2005, 04:02 PM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by TheMayhem
Hmmm I figured if I used " then php could get an error... guess not.
if you're echoing out the data then you need to escape each backslash or just go back to using apostraphies, however if it's a template then theirs no issues

Quote:
Originally Posted by TheMayhem
Hmmm I figured if I used " then php could get an error... guess not. My last question is now for my news I want to display a loop statement, which I use a while. Now I know this won't work correctly because I'm using a mysql_fetch_array query inside a while statement and it is going to loop the number of times I have an entree in the db. So how exactly could I take a while statement that is going to loop and actually store the information in the template so it shows each and every loop, such as $news[news_name] should loop 8 times and thus loops 8 times in the template and shoes each array being different then the last?
your best bet would be to write out the code (or what you think the code would look like for what you're trying to acheive) and post it, then i'd have a better idea of what you mean.
Reply With Quote
  #16  
Old 01-22-2005, 04:25 PM
TheMayhem's Avatar
TheMayhem TheMayhem is offline
 
Join Date: Oct 2002
Location: Pittsburgh, Pa
Posts: 526
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

LoL sorry, I know you'll understand it this way.

PHP Code:
$news_query mysql_query("select * from news ORDER BY `categorys_order` ASC");
    while (
$news_showmysql_fetch_array($news_query)) {
// echo "$news_show[news_name];

Just a simple while statement. Now I can't just store it in the templates and call upon $news_show[news_name] because it won't display since this thing is going to loop several times. So how could I get it in the templates to show the results of each loop?
Reply With Quote
  #17  
Old 01-22-2005, 04:34 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't understand what you want, but I guess you want this:

PHP Code:
eval('$news .= "' $compiled_news_template '";'); 
Reply With Quote
  #18  
Old 01-22-2005, 04:40 PM
TheMayhem's Avatar
TheMayhem TheMayhem is offline
 
Join Date: Oct 2002
Location: Pittsburgh, Pa
Posts: 526
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nah I don't think your following me. You have a while { }. Let's say it loops 5 times and the following pieces of data it is going to pull from the same table in the database becaused you used a get array query.
John
Joe
Jerry
James
Judy

It retrieves 5 names. And in order to retrieve those 5 names all I had to type inside the while brackets were something like $news[display_names]. That is it.

Well on the template how could I get it so that it displays all 5 loops so each name is displayed because I can't write the php statement inside the template, nor can I output the echo statement inside the while loop. I know vBulletin does this when it wants to ouput like each forum's description, name, and so forth on their forumhome but vb uses a lot more coding that is far too advanced and complex for my simple brain. Any ideas?
Reply With Quote
  #19  
Old 01-22-2005, 04:49 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So in simple words:
You want the news_name values from all rows in the table in one string?

Before the while:
PHP Code:
$newsnames = array(); 
In the wile:
PHP Code:
$newsnames[] = $news_show['news_name']; 
After the while
PHP Code:
$newsnames implode(' '$newsnames); 
Reply With Quote
  #20  
Old 01-22-2005, 05:33 PM
TheMayhem's Avatar
TheMayhem TheMayhem is offline
 
Join Date: Oct 2002
Location: Pittsburgh, Pa
Posts: 526
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The implode function works... but not exactly as needed. I'm trying to retrieve 3 specific bits of information. news_name, news_id, news_description. When i use the implode function I can only assign one variable and have it implode one bit of information. To make it easier to understand this is what I want it to look like when complete for the output.

<tr>
<td>$news_name</td><td>$news_id</td><td>$news_description</td>
</tr>

So it'd display the following bits of info on the output
Joe 1 This is my piece of writing
John 2 I don't like writing
Jerry 3 Wow I can't believe I did this
Jose 4 WEEEE!

Currently it'll display
JoeJohnjerryJose 1234 ect.

Basically I want to use a little simple html to seperate everything a bit and for me to only have to call upon a few variables in my templates in order to complete this process.

With the implode function I can't necessarily do that because if I call upon something like $news_name it will loop all the $news_names that I have selected. And thus on the output will look horribly ugly. Is there any function i can use so I could like insert this html and it'd select those 3... then loop again and keep looping like the implode function did until the while statement is over?
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 08:45 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.04065 seconds
  • Memory Usage 2,280KB
  • Queries Executed 11 (?)
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_html
  • (7)bbcode_php
  • (3)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
  • (2)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