PDA

View Full Version : A more "blog like" VB Journal Last Entries Module


bbensen
10-18-2004, 07:05 PM
This hack is for [vB 3.0.3] - vB Journal for vBulletin 3.0.3(v1.0.0) and [vB 3.0.3] - vB Journal | vba CMPS module: latest entries

So you must have VB Journal for vBulletin 3.0.3(v1.0.0) installed

Below is the more blog like version of Bolas' mod. I am working on the RSS portion of this to make it even more "blog like". The entry title is 50 chars and the body of the entry is 150 chars and then the "more..." link to the entry.

Please note that this only shows the first jounalists' entries. On my site (http://www.surfthisphotography.com) I only wanted my entries to appear on the front page. You can change that by modifying the WHERE portion of the query "journals.journalist_id = 1" to whatever ID you wish to display or by removing it.

touch /path_to_your_forum_dir/modules/journalentries.php

<?php
// ######################### Latest Forum Topics #########################
$getlateste= $DB_site->query("SELECT journal_entries.entrytitle,journal_entries.entrydate,
journal_entries.entry_id,journal_entries.entrytext,
journal_entries.journal_id,journals.journalist,journals.journalist_id, journals.commentcount
FROM ".TABLE_PREFIX."journal_entries AS journal_entries
LEFT JOIN ".TABLE_PREFIX."journals AS journals ON (journal_entries.journal_id=journals.journal_id)
WHERE journal_entries.entry_active=1 AND journal_entries.private!=1 AND journals.private!=1 and journals.journalist_id = 1
ORDER BY journal_entries.entrydate DESC
LIMIT 5
");
$countlatest= $DB_site->num_rows($getlateste);
$latestentrybits = "";
if($countlatest>0)
{
while($latest= $DB_site->fetch_array($getlateste))
{
$latestentrydate= vbdate($vboptions['dateformat'], $latest['entrydate'], 1);
$latestentrytime= vbdate($vboptions['timeformat'], $latest['entrydate']);
exec_switch_bg();
if(strlen($latest[entrytitle])>20)
{
$latest[entrytitle]= "".substr($latest[entrytitle],0,50);
}
if(strlen($latest[entrytext])>150)
{
$latest[entrytext]= "".substr($latest[entrytext],0,200)."<div class='smallfont'><a href='$vboptions[bburl]/journal.php?do=showentry&e=$latest[entry_id]' title='$latest[entrytext]'>more...</a>";
}
eval('$latestentrybits .= "' . fetch_template('journal_latestentrybits') . '";');
}
$DB_site->free_result($latest);
}
else
{
$latestentrybits=$vbphrase['adv_no_entries'];
}


eval('$home[$mods[\'modid\']][\'content\'] = "' . fetch_template('adv_portal_latestjournalentry') . '";');

$DB_site->free_result($getlateste);
unset($latestentrybits,$latest,$latestentrytime,$latestentrydate,$countlatest);

?>



then create template 'adv_portal_latestjournalentry'


<table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%">
<thead>
<tr>
<td class="tcat">
<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('cmps_pagesmenu')"><img id="collapseimg_cmps_pagesmenu" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_cmps_pagesmenu].gif" alt="" border="0" /></a>
<span class="smallfont"><strong>$vbphrase[adv_latest_journalentries]</strong></span>
</td>
</tr>
</thead>
<tbody id="collapseobj_cmps_pagesmenu" style="$vbcollapse[collapseobj_cmps_pagesmenu];text-align:$stylevar[left]">
$latestentrybits
</tbody>
</table>
<br />


Modify the journal_latestentrybits

<tr>
<td class="$bgclass"><div class="smallfont">$latestentrydate </br><a href="$vboptions[bburl]/journal.php?do=showentry&e=$latest[entry_id]" ><b>$latest[entrytitle]</b></a> <br /></div></td>
<tr><td class="$bgclass"><blockquote><div class="smallfont">$latest[entrytext]</div></blockquote><span style="cursor:pointer" onclick="window.open('member.php?u=$latest[journalist_id]')">Posted by:&nbsp;$latest[journalist] </span>at <span class="time">$latestentrytime</span> ($latest[commentcount] comments)</td></tr>
</tr>

Now add 2 GLOBAL phrases:
$vbphrase[adv_latest_journalentries] = "Latest Journal Entries"
$vbphrase[adv_no_entries] = "No Journal Entries"



Then create a new module:
Module Title: Journal Latest Entries
File to include: journalentries.php
Active: yes
Column: center
Templates Used: adv_portal_latestjournalentry, journal_latestentrybits


Live example towards the bottom of the page. Surf this... photography (http://www.surfthisphotography.com)

This also displays the number of comments next to the author and the time the entry was added.

Bill Bensen

Blaminator
11-07-2004, 12:23 PM
Anyway to get this on another page??

Our Sponsors
 

bbensen
11-07-2004, 02:54 PM
I don't understand the question.

Blaminator
11-07-2004, 03:37 PM
You can make new pages in VBA CMPS, I want to know if you could get this onto a new page

Our Sponsors
 

bbensen
11-07-2004, 09:12 PM
I would assume so, but I've never created a new page. I know that Brian is very busy with the new Gallery, but there must be someone else that would know more than I do about that.

phoenixdown
11-07-2004, 09:27 PM
If you want this module to appear in a new page,...

1. Add the module and when it asks you to update all pages, select No.

2. Go into the add a new page. Name it whatever you want but in the next selection just check off the module blocks you want displayed.

That should work.

Blaminator
11-08-2004, 12:19 AM
Parse error: parse error, unexpected T_STRING, expecting ',' or ')' in /home/xxxxxx/public_html/forum/modules/journalentries.php on line 42

bbensen
11-11-2004, 01:25 PM
As you can see in the code above has a space in it, it's something with VBB and showing code. Just remove the space in $latestentrydate and it will work fine.

unset($latestentrybits,$latest,$latestentrytime,$latestentrydate,$countlatest);

This should fix the error.

BB

P.S. I pasted this code in every editor I have and I still get the space when it's posted back to VBB. Weird :confused:

Blaminator
11-11-2004, 01:54 PM
Database error in vBulletin 3.0.2:

Invalid SQL: SELECT journal_entries.entrytitle,journal_entries.entryda te,
journal_entries.entry_id,journal_entries.entrytext ,
journal_entries.journal_id,journals.journalist,jou rnals.journalist_id, journals.commentcount
FROM journal_entries AS journal_entries
LEFT JOIN journals AS journals ON (journal_entries.journal_id=journals.journal_id)
WHERE journal_entries.entry_active=1 AND journal_entries.private!=1 AND journals.private!=1 and journals.journalist_id = 1
ORDER BY journal_entries.entrydate DESC
LIMIT 5

mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '.journalist_id, journals.commentcount
FROM journal_entries AS j

mysql error number: 1064

Date: Thursday 11th of November 2004 01:52:59 PM
Script: http://www.blaminator.co.uk/?page=blog
Referer:
Username: Blaminator
IP Address: **********

karlsson
11-14-2004, 01:08 AM
works fine when all spaces are removed ;)

another question:
i have added bbcode to my journal. the journal can handle bbcode, but the last entries module not.
is there any way to make the module handle bbcode ?



:confused:

russbo
11-30-2004, 11:53 PM
I've installed all of this verbatim, and nothing is showing up on my index page (http://x.russbo.com/index.php). Even in the page source, I am not seeing a block for latest journal entries. However, my journal is working in my forum, which is at http://x.russbo.com/vb/index.php

any idea where I might have gone wrong???

Nordinho
04-11-2005, 07:55 AM
Any idea's how to trim an img tag/or to skip it in the latest entry?? (some of my users use pics with really long url's that break the frontpage layout, when the img code for the pic is at the start of a post)

Nordinho
04-20-2005, 08:05 AM
bump ;)

+buG
04-20-2005, 07:45 PM
omg the picture of your head is gross!

Nordinho
04-22-2005, 11:08 AM
omg the picture of your head is gross!

hmmm :confused:

Judge Ruckus
07-18-2005, 03:27 AM
I need an "Identifier" for this to even start workin for VBA 2.

What should I use as an Identifier?

NOte: Like an azzhole I thought I would just use "1" as an Identifier to see what would happen. I guess you know that was not the answer.

I am really not digging the way VBA2 adds new mods, everytime I try to add something new its a problem to be dealt with.

mindcry
08-08-2005, 01:00 PM
I did everything as described above and when I try and go to my portal page, it is completely blank.

Rukas
10-25-2005, 12:56 AM
Anything like this for vBadvanced CMPS v2.0.0 (vB 3.5)?

psilocybin
02-25-2006, 12:30 AM
still looking for something like this for 2.0 and 3.5.