vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   PHPNuke to vB Hack (https://vborg.vbsupport.ru/showthread.php?t=6218)

01-09-2001 05:27 PM

Yet the code makes it slower... exactly the reason I'm busy coding my own news manager... no messy stuff :)

01-09-2001 07:50 PM

I just started playing with this and it works great for the purposes I need. I did modify it so it was more tightly integrated with vBulletin.

Full news system in a few lines of code.
Code:

<?php

require("global.php");

//  Newsforum -- The forum that the script will pull news headlines from.  Unless you want all
//  your users to be able to update your news, you may want to consider limiting this forum to
//  Moderators posting new threads...this is easily done via the vB control panel.

$newsforum = 11;

//  News Limit -- How many stories should be displayed?

$bfc_newslimit = 2;

$isnews = 1;
$newsbits="";
$threads=$DB_site->query("SELECT * FROM thread WHERE forumid=$newsforum ORDER BY dateline DESC LIMIT $bfc_newslimit");
while ($thread=$DB_site->fetch_array($threads)) {
  $postdate=date($dateformat,$myrow[dateline]+(($timeoffset+$bbtimezoneoffset)*3600));
  $posttime=date($timeformat,$myrow[dateline]+(($timeoffset+$bbtimezoneoffset)*3600));
  $replycount=$thread[replycount];
  $username=$thread[postusername];
  $newstitle=$thread[title];
  $threadid=$thread["threadid"];
  if ($replycount == "0") {
    $replies = "";
  }
  elseif ($replycount == "1") {
    $replies = "| (1 Comment)";
  }
  else {
    $replies = "| ($replycount Comments)";
  }
  $posts=$DB_site->query("SELECT post.userid, pagetext,user.username as username
                          FROM post LEFT JOIN user ON (post.userid = user.userid)
                          WHERE threadid=$threadid ORDER BY postid LIMIT 1");
  $postinfo=$DB_site->fetch_array($posts);
  $userid=$postinfo[userid];
  $username=$postinfo[username];
  //$dept=$postinfo[dept],
  //$category=$posts[category];
  $message=bbcodeparse($postinfo[pagetext],$forumid,1);
  eval("\$newsbits .= \"".gettemplate("newsbit")."\";");               
}

eval("echo dovars(\"".gettemplate("news")."\");");

News Template
Code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD><TITLE>$bbtitle - $forumtitle</title>
$cssinclude
</head>
<body>
$header
<center>
<table border="0" width="98%" cellpadding="2">
  <tr>
  <td bgcolor="#FFFFFF">$newsbits</td>
  </tr>
</table>
</center>
$footer
</body>
</html>

Newsbit Template:
Code:

<table width="{newswidth}" border="0" cellpadding="1" cellspacing="0" bgcolor="#6c6081">
  <tr>
                <td>
            <table width="100%" border="0" cellpadding="2" cellspacing="0" bgcolor="#FFFFFF">
              <tr><td valign="middle"><font face="Tahoma, Verdana, Arial" color="#afa3c5"><b>$newstitle</b></font></td></tr>
            </table>
          </td>
  </tr>
</table>
<table width="{newswidth}" border="0" cellpadding="0" cellspacing="0" bgcolor="#EFEFEF">
  <tr>
                <td valign="top">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr><td valign="top"><p><b>Posted by: [<a href="member.php?action=mailform&userid=$userid">$username</a>] on $postdate at $posttime</b></tr>
                      <tr><td valign="top"><p>$message<br><br><smallfont><a href="showthread.php?threadid=$threadid">Read More</a> $replies<br><br></td></tr>
                    </table>
          </td>
  </tr>         
</table>

I am currently adding more portal like stuff to it but no previews. Of course I have a long way to go to catch up to PHP-Nuke but I like creating my own stuff. It is pretty sparse now but I will be adding to it over the day...

http://sitepointforums.com/news.php

[Edited by wluke on 01-09-2001 at 04:54 PM]

01-09-2001 08:30 PM

I've played with bcf_weblog and it works really well, but the reason I'm playing with PHPNuke is that there were numerous requests for it and I thought it would be a fun project to try since I know nothing about PHP and want to learn.

Any of you that know PHP well enough to create a hack from scratch would be able to duplicate the functionality of PHPNuke, thats not me, but I haven't seen anything in it to damage the brain yet and there are some really good ideas to be had for any project anyone might be working on.

So I'll continue my project for now, at least till vB 2.0 comes out. ;)

01-09-2001 08:42 PM

Quote:

Originally posted by wajones
I've played with bcf_weblog and it works really well, but the reason I'm playing with PHPNuke is that there were numerous requests for it and I thought it would be a fun project to try since I know nothing about PHP and want to learn.

Any of you that know PHP well enough to create a hack from scratch would be able to duplicate the functionality of PHPNuke, thats not me, but I haven't seen anything in it to damage the brain yet and there are some really good ideas to be had for any project anyone might be working on.

So I'll continue my project for now, at least till vB 2.0 comes out. ;)

If it works for you, then go for it. I mainly posted that for those who said they were having a hard time getting things to work. This would be simpler for some people.

I realize you said this was a work in progress but from some comments, it looks like others are looking for polished integration with detailed instructions. It appears you haven't gotten that far yet from your own posts. :)

01-09-2001 08:59 PM

I've been dying for some integration between the two. I understand that you're just experimenting, but it's something I've been hoping to do myself whenever I got the freetime.

I know there is the weblog hack, but the ability to change views, and other nuke features make it different IMHO. I've got quite a few ideas for Nuke myself, and would love to use Nuke with vB someday.

By the time vBulletin 2.0 comes out, hopefully there will be a PHP Nuke version that has no bugs, isn' soooo slow, and has clean code.

If you're looking for help, you may want to create a sourceforge project. I know there are already a number of Nuke forks, but if you were to post the project, you may be able to get a couple people to help out with a port.

Thanks for the work, keep it up,
-Cameron

[Edited by BassWriters on 01-09-2001 at 06:01 PM]

01-09-2001 09:14 PM

Heya wluke

Is there a way to limit how much is shown on the news page?

Like limit it to 100 characters or 50 words.. like phpnuke I guess?

Thanks.

01-09-2001 09:24 PM

Quote:

Originally posted by wajones
Well, since I'm not a PHP programer and in fact not good at programming anything. soooo I'll never know the difference ;) Beside's if I can get the functionallity of the Nuke addon's and still be able to utilize vB for the important core then I'll be happy.

You are right about the Nuke code being crappy and inconsistant, that's what you get being the code has been pieced together by many different people. But if it works it's a starting point and I haven't seen many offer a front end portal with as much functionallity and ease of installation and use for the price yet. [/B]
I totally agree with you wajones. To me personally, the code is not that slow and have yet to see another portal with that type functionality. I was also planning on integrating vbulletin with nuke but as for now I don't know PHP. I am currently caught up in trying to study for my Cisco certification. After I got to a stopping point, I was planning to teach myself PHP. Nuke optimization was definately on the list also.

Currently I am satisfied with the "crappy code" in it's present state and with the upcomming optimations I would like it even more. By the way, the code is open source. If you don't like it. Change it or don't use it.

01-09-2001 09:33 PM

BassWriters

Unfortunately the next version of PHPNuke will have PHPBB integrated making it harder to hack for vB, so we may be stuck with the present version.

The problem with the source forge idea, besides vB being a commercial product. I wouldn't have the time or know how to manage such a thingy. Plus I really don't want to make it a career.

So with that... I'll share what I've done as is, as soon as I can figure out "what I've done" and how to package it up with whom ever is interrested. If someone else wants to create and manage a full blown project I'll help as much as I can.

01-09-2001 09:38 PM

Quote:

Originally posted by _
Heya wluke

Is there a way to limit how much is shown on the news page?

Like limit it to 100 characters or 50 words.. like phpnuke I guess?

Thanks.

I'm was working on another project with weblog that does that but you have to modify the datadase as I did, or truncate what you show... wluke can probably show you that, I know you can, but don't know how right off.

This is the weblog I'm, or was working on http://www.oldamigos.com/forums/main.php

[Edited by wajones on 01-09-2001 at 06:50 PM]

01-09-2001 09:56 PM

To limit the amount of characters shown you would do something like:
Code:

        if (strlen($message) > 160) {
          $snippet = substr($message,0,160) . " (<a href=\"".$lastposturl."\">more...</a>)<br>";
        } else {
          $snippet = $message;
        }

Then reference $snippet in the template instead of $message.


All times are GMT. The time now is 06:59 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.01121 seconds
  • Memory Usage 1,760KB
  • 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
  • (4)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)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