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

Reply
 
Thread Tools Display Modes
  #1  
Old 06-14-2005, 11:05 AM
playboy playboy is offline
 
Join Date: Jul 2003
Posts: 45
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default php code On The Forums???

I tried adding a php code to my forums and it didn't work, its just a blank space.... any ideas ?
Reply With Quote
  #2  
Old 06-14-2005, 11:07 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Don't use dreamweaver.
Reply With Quote
  #3  
Old 06-14-2005, 11:27 AM
playboy playboy is offline
 
Join Date: Jul 2003
Posts: 45
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I didnt use dreamweaver, I run a wrestling web site and have a news posting system (cutenews) and theres a code you put on your webpage which puts the news you add on to the page... Well I put it in one of the sidebars for the left_sidebar hack, but when I went to my forum home it wasn't showing, there was nothing...

<?PHP
$PHP_SELF = 'msm.php';
$category = "2";
$number = "27";
$template = "Headlines";
include("cutenews/show_news.php"); ?>

Thats the code I'm trying to add... any thoughts?
Reply With Quote
  #4  
Old 06-14-2005, 11:35 AM
Colin F's Avatar
Colin F Colin F is offline
 
Join Date: Jul 2004
Location: Switzerland
Posts: 1,551
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by playboy
I didnt use dreamweaver, I run a wrestling web site and have a news posting system (cutenews) and theres a code you put on your webpage which puts the news you add on to the page... Well I put it in one of the sidebars for the left_sidebar hack, but when I went to my forum home it wasn't showing, there was nothing...


<?PHP
$PHP_SELF = 'msm.php';
$category = "2";
$number = "27";
$template = "Headlines";
include("cutenews/show_news.php"); ?>


Thats the code I'm trying to add... any thoughts?
You can't add php code directly to the template.

What you can do is insert the php code in the phpinclude_start template, and map the output to a variable.

Then, use this variable to display whatever your code output.
Reply With Quote
  #5  
Old 06-14-2005, 11:59 AM
playboy playboy is offline
 
Join Date: Jul 2003
Posts: 45
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't mean to come off as a total idiot but... how do I add a variable? Like is there a certain code I have to apply... I know a variable is something like $headlines But I just dont know how to set one up... :surprised: Same thing with setting up an output... I've been working with vB for about 5 months but I've never had to do anything of this sort.
Reply With Quote
  #6  
Old 06-14-2005, 12:28 PM
blueshift's Avatar
blueshift blueshift is offline
 
Join Date: Jun 2005
Location: Newcastle, England
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by playboy
<?PHP
$PHP_SELF = 'msm.php';
$category = "2";
$number = "27";
$template = "Headlines";
include("cutenews/show_news.php"); ?>
On the page you're trying to put this information on (I'm guessing it'll be index.php?), you'll have to download the php file, and add that information (quoted) to the file, somewhere above this:

PHP Code:
// ### ALL DONE! SPIT OUT THE HTML AND LET'S GET OUTA HERE... ### 
Although I'm not really sure how your news system is printing this information.. you may want to give some more details on it so I can analyze the solution further. I don't think you need the $PHP_SELF variable, but I could be wrong. You'll have to inform me on what exactly is included with the "show_news.php", as well as what's involved within the "msm.php" file.

However, setting up a variable is easier than you might think. Basically it is assigning something to something. By this I mean, you can set a number to a variable, and use that variable to print off the number. For example:

PHP Code:
$"1"
Using the term $1 anywhere in your page, would print "1". You can do almost anything with variables when you get fluent enough with them.
Reply With Quote
  #7  
Old 06-14-2005, 02:14 PM
playboy playboy is offline
 
Join Date: Jul 2003
Posts: 45
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

show_news:

Code:
<?PHP

error_reporting (E_ALL ^ E_NOTICE);

$cutepath =  __FILE__;
$cutepath = preg_replace( "'\\\show_news\.php'", "", $cutepath);
$cutepath = preg_replace( "'/show_news\.php'", "", $cutepath);

require_once("$cutepath/inc/functions.inc.php");
require_once("$cutepath/data/config.php");

//----------------------------------
// Check if we are included by PATH
//----------------------------------
if($HTTP_SERVER_VARS["HTTP_ACCEPT"] or $HTTP_SERVER_VARS["HTTP_ACCEPT_CHARSET"] or $HTTP_SERVER_VARS["HTTP_ACCEPT_ENCODING"] or $HTTP_SERVER_VARS["HTTP_CONNECTION"]){ /* do nothing */ }
elseif(eregi("show_news.php", $PHP_SELF)){
die("<h4>CuteNews has detected that you are including show_news.php using the URL to this file.<br>
This is incorrect and you must include it using the PATH to show_news.php</h4><br>Example:<br>
this is <font color=red>WRONG</font> :&nbsp;&nbsp; &lt;?PHP include(\"http://yoursite.com/cutenews/show_news.php\"); ?&gt;<br>
this is <font color=green>CORRECT</font>:&nbsp;&nbsp; &lt;?PHP include(\"cutenews/show_news.php\"); ?&gt;<br>
<br><BR>// <font size=2>if you think this message shouldn't be shown, open show_news.php and delete it from there</font>");
}
//----------------------------------
// End of the check
//----------------------------------

if(!isset($subaction) or $subaction == ""){ $subaction = $POST["subaction"]; }

if(!isset($template) or $template == "" or strtolower($template) == "default"){ require_once("$cutepath/data/Default.tpl"); }
else{
        if(file_exists("$cutepath/data/${template}.tpl")){ require_once("$cutepath/data/${template}.tpl"); }
    else{ die("Error!<br>the template <b>".htmlspecialchars($template)."</b> does not exists, note that templates are case sensetive and you must write the name exactly as it is"); }
}

// Prepare requested categories
if(eregi("[a-z]", $category)){
        die("<b>Error</b>!<br>CuteNews has detected that you use \$category = \"$category\"; but you can call the categories only with their <b>ID</b> numbers and not with names<br>
    example:<br><blockquote>&lt;?PHP<br>\$category = \"1\";<br>include(\"path/to/show_news.php\");<br>?&gt;</blockquote>");
}
$category = preg_replace("/ /", "", $category);
$tmp_cats_arr = explode(",", $category);
foreach($tmp_cats_arr as $key=>$value){
    if($value != ""){ $requested_cats[$value] = TRUE; }
}

if($archive == ""){
        $news_file = "$cutepath/data/news.txt";
        $comm_file = "$cutepath/data/comments.txt";
}else{
        $news_file = "$cutepath/data/archives/$archive.news.arch";
        $comm_file = "$cutepath/data/archives/$archive.comments.arch";
}

$allow_add_comment                        = FALSE;
$allow_full_story                        = FALSE;
$allow_active_news                         = FALSE;
$allow_comments                         = FALSE;

//<<<------------ Detarime what user want to do
if( $CN_HALT != TRUE and $static != TRUE and ($subaction == "showcomments" or $subaction == "showfull" or $subaction == "addcomment") and ((!isset($category) or $category == "") or $requested_cats[$ucat] == TRUE) ){
    if($subaction == "addcomment"){ $allow_add_comment        = TRUE; $allow_comments = TRUE; }
    if($subaction == "showcomments") $allow_comments = TRUE;
        if(($subaction == "showcomments" or $allow_comments == TRUE) and $config_show_full_with_comments == "yes") $allow_full_story = TRUE;
        if($subaction == "showfull") $allow_full_story = TRUE;
        if($subaction == "showfull" and $config_show_comments_with_full == "yes") $allow_comments = TRUE;

}
else{
    if($config_reverse_active == "yes"){ $reverse = TRUE; }
        $allow_active_news = TRUE;
}
//----------->>> Detarime what user want to do

require("$cutepath/inc/shows.inc.php");
    if($_GET['archive'] and $_GET['archive'] != ''){ $archive = $_GET['archive']; } // stupid fix ?
unset($static, $template, $requested_cats, $category, $catid, $cat,$reverse, $in_use, $archives_arr, $number, $no_prev, $no_next, $i, $showed, $prev, $used_archives);
?>
<!-- News Powered by CuteNews: http://cutephp.com/ -->
with the news system it allows me to post news articles on my website, and on my websites main page it just shows the titles of the news articles in order like this:

>> article 1 blahblahblah
>> article 2 somethingsomethingsomething
>> article 3 --asd-as-d-asd-a-sd-a-sd-sad

And when you click on the link, the msm.php is just the template for the page it'll be taken too which contains the full article. In the php code I'm trying to put up will just put the links (like I poorly exampled above ) so members can click the link and be taken to the news article that is part of the main site...

Its very hard to explain, hopefully I was clear enough. :-)
Reply With Quote
  #8  
Old 06-14-2005, 02:48 PM
blueshift's Avatar
blueshift blueshift is offline
 
Join Date: Jun 2005
Location: Newcastle, England
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I see, I see.. so you want this on your main website, or on your forums?
Reply With Quote
  #9  
Old 06-14-2005, 04:02 PM
playboy playboy is offline
 
Join Date: Jul 2003
Posts: 45
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Forums -- Its already on my main site.

Nope man... Didnt Work :-( Anyone Else have some suggestions?
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 06:17 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.01983 seconds
  • Memory Usage 2,258KB
  • Queries Executed 13 (?)
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
  • (2)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)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_postinfo_query
  • fetch_postinfo
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete