vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Can anyone see any problems with this code? (https://vborg.vbsupport.ru/showthread.php?t=78520)

BigIke 03-21-2005 09:26 PM

So, I don't need the <iframe> part in there at all and have the module call adv_portal_features (the template)?

BTW: I opened the forum back up so you can see the problem occurring.

Everything is cool now. Thanks for all of your help

Deaths 03-22-2005 08:30 AM

Yes, add your PHP file to your modules list, and it should work.

Have you pu the layout of your module in your PHP file? If so, place it in a template.

BigIke 03-22-2005 11:14 PM

My only problem is that I am not sure how to format the template. The module is activated and it includes features.php, but I am unsure what to put in the template to display the information that the php script retrieves. Anyone have any ideas?

Deaths 03-23-2005 10:41 AM

Post the script you coded here, else we can't help you.

BigIke 03-23-2005 06:33 PM

It's the same one as above. Here it is
Code:

<?php

/* Needed for use without vBA
 require_once('./global.php');
*/


/* ###### VARIOUS SETTINGS ###### */

$box_max_title_length=30;
$box_max_post_length=80;
$box_do_parse=0; /* Set to 1 to parse BBCODE */
$box_attachment_file="http://s116946478.onlinehome.us/vb/attachment.php?";

/* ###### GRABBING DATA ###### */

/* Only needed if you're going to be using bbcode */
if($box_do_parse==1){require_once('./includes/functions_bbcodeparse.php');}

/* Forum to Grab thread/post from */
$box_forumid_1=2;

/* Grabbing the thread */
$box_forumid_1thread = $DB_site->query_first("SELECT * FROM ".TABLE_PREFIX."thread
WHERE forumid = '$box_forumid_1' ORDER BY thread.dateline DESC ");

/* Grabbing the first post */
$box_forumid_1_first_post=$DB_site->query_first("SELECT * FROM ".TABLE_PREFIX."post
WHERE threadid = '$box_forumid_1thread[threadid]' ORDER BY dateline ASC");

/* Grabbing the first attachment */
$box_forumid_1_image=$DB_site->query_first("SELECT * FROM ".TABLE_PREFIX."attachment
WHERE postid = '$box_forumid_1_first_post[postid]' ORDER BY dateline DESC");

$image1=$box_forumid_1_image['attachmentid'];

/* ###### FORMATING DATA ###### */

/* Max title length */
if(strlen($box_forumid_1thread[title])>$box_max_title_length){
$box_forumid_1thread[title]=substr($box_forumid_1thread[title], 0, $box_max_title_length);
}

/* Max post length */
if($box_forumid_1_first_post[pagetext]>$box_max_post_length){
$box_forumid_1_first_post[pagetext]=substr($box_forumid_1_first_post[pagetext], 0, $box_max_post_length);
}

/* Parse BBCODE if desired */
if($box_do_parse==1){
$box_forumid_1_first_post[pagetext]=parse_bbcode($box_forumid_1_first_post[pagetext]);
}

/* IMAGE CREATION */
$box_1_image="<img src='".$box_attachment_file."attachmentid=$img_m&stc=1' width='100' height='100' border='0'/>";

/* Template to use for data */
eval('$home[$mods[\'modid\']][\'content\'] = "' . fetch_template('adv_portal_features') . '";');

?>


Deaths 03-24-2005 03:00 PM

What info do you want displayed?

BigIke 03-24-2005 09:49 PM

hey i got it all sorted out finally. Thanks for all the help, especially from Deaths and noppid.

actually, lol, i have one other thing... I got the title pulled, but how do i make it a link to that post? and the cut off is at 150 words, but how do i create a link that says "read more", for my users to read the rest of the posts?

Deaths 03-25-2005 02:27 PM

Link to thread:
Code:

<a href="showthread.php?t=$box_forumid_1thread[threadid]">$box_forumid_1thread[title]</a>
.

To limit the message to a certain amount of chars (in this case 250):

PHP Code:

if (strlen(YOUR_VAR_FOR_MESSAGE) > '250')
            {
                
YOUR_VAR_FOR_MESSAGE fetch_trimmed_title(YOUR_VAR_FOR_MESSAGE'250' construct_phrase($vbphrase['read_more'], $vboptions['bburl'], $box_forumid_1thread['threadid'], $session['sessionurl']);
            } 

Don't forget to replace the YOUR_VAR_FOR_MESSAGE text with the variable you use for your message!
The PHP code must be added to the PHP file, BELOW the query, and BELOW the parsing of the bbcode in it (if you parse it), but ABOVE the calling for the template.

That should work, if not, let me know.

BigIke 03-26-2005 03:50 PM

The link to the thread worked great. I'm not sure what you mean by the variable I use for my message, though..

Deaths 03-26-2005 03:57 PM

Well, how do you display that text?


All times are GMT. The time now is 11:59 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.01295 seconds
  • Memory Usage 1,738KB
  • 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
  • (2)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)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