vBadvanced Forums  
Go Back   vBadvanced Forums > vBadvanced Products > vBadvanced CMPS > vBa CMPS v1.x (Archive - Closed for Posting) > Troubleshooting / "How do I..." Questions

 
 
Thread Tools Display Modes
  #1  
Old 06-13-2004, 07:13 PM
Bryant Bryant is offline
Junior Member
 
Join Date: Mar 2004
Posts: 13
Default Hoping someone with a PHP and CMPS clue can tell me what's wrong here.

I desperately need a CMPS module for v3articles, and after asking about it in a couple places a few days ago, decided I'd try to see if I could make one myself.

First, let me say I know no PHP, I have no real capacity with code, I've just been slogging through this with trial and error for the past few days. So if something is stupidly handled below, that's why.

When I use eval('print_output, and run this .php file from the modules directory for CMPS, it successfully pulls the featured article and displays it. But when I comment out print_output, and replace it with eval('$home[$mods as other modules use, it doesn't pull anything at all into the module I created on the site. For the sake of simplicity, I'm not even trying to pull the featured article image, if there is one. One thing at a time.

Is there an easy answer as to why it won't populate the module on the CMPS index page?

PHP Code:
<?php

// Enter the full path to your forum here.
chdir('/path_here');

// get special data templates from the datastore
$specialtemplates = array(
    
'attachmentcache',
    
'featuredarticle'
);

// pre-cache templates used by all actions
// $globaltemplates = array(
//    'adv_portal_ARTICLE'
// );

// pre-cache templates used by specific actions
$actiontemplates = array(
    
'article_cmps'
);

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
require_once(
'./includes/functions_articles.php');

// ###################### FEATURED ARTICLE TEASER ########################
$featuredarticle unserialize($datastore['featuredarticle']);
if (
$featuredarticle['id'])
{
    
$feature $DB_site->query_first("SELECT article.*, articlepost.*, articlecategory.options AS options FROM " TABLE_PREFIX "article AS article
    INNER JOIN " 
TABLE_PREFIX "articlepost AS articlepost ON (articlepost.postid = article.firstpostid)
    INNER JOIN " 
TABLE_PREFIX "articlecategory AS articlecategory ON (articlecategory.categoryid = article.categoryid)
    WHERE article.articleid=
$featuredarticle[id]");
}
if (!empty(
$feature['title']))
{

    
// do html
    
if ($feature['options'] & 256)
    {
        
$dohtml 1;
    }
    
    if (
$feature['options'] & 512)
    {
        
$dosmilies 1;
    }
    
    
// get an attachment, if there's one with a thumnail
//    $attachment = $DB_site->query_first("SELECT attachmentid FROM " . TABLE_PREFIX . "articleattachment WHERE articleid=$featuredarticle[id] AND thumbnail_dateline>1 ORDER BY RAND() LIMIT 0,1");
//    if (!empty($attachment['attachmentid']))
//    {
//        $GLOBALS['isattachment'] = true;
//    }            
    
    
require_once('./includes/functions_bbcodeparse.php');
    
$feature['postbody'] = truncate_text($feature['postbody'], $vboptions['featuredlength'], 1);
    
$feature['postbody'] = parse_bbcode2($feature['postbody'], $dohtml0$dosmilies1);
    
    eval(
'$articlecontent .= "' fetch_template('article_cmps') . '";');
}
// eval('print_output("' . fetch_template('adv_portal_blog') . '");');
eval('$home[$mods[\'modid\']][\'content\'] .= "' fetch_template('adv_portal_blog') . '";');
?>
Thanks in advance for any insight.

Last edited by Bryant; 06-13-2004 at 07:20 PM.
  #2  
Old 06-13-2004, 11:09 PM
Bryant Bryant is offline
Junior Member
 
Join Date: Mar 2004
Posts: 13
Default Re: Hoping someone with a PHP and CMPS clue can tell me what's wrong here.

There's someone else's thread on a similar issue here, just as an FYI. Still hoping someone can shed some light here, but I'll just be happy when any v3articles->CMPS module is ready.
  #3  
Old 06-15-2004, 11:42 AM
Brian's Avatar
Brian Brian is offline
Administrator
 
Join Date: Jan 2004
Location: Georgia, USA
Posts: 34,240
Default Re: Hoping someone with a PHP and CMPS clue can tell me what's wrong here.

Well I can tell you that first off, all of this should be removed:
PHP Code:
// Enter the full path to your forum here. 
chdir('/path_here'); 

// get special data templates from the datastore 
$specialtemplates = array( 
    
'attachmentcache'
    
'featuredarticle' 
); 

// pre-cache templates used by all actions 
// $globaltemplates = array( 
//    'adv_portal_ARTICLE' 
// ); 

// pre-cache templates used by specific actions 
$actiontemplates = array( 
    
'article_cmps' 
); 

// ######################### REQUIRE BACK-END ############################ 
require_once('./global.php'); 
Other than that, I don't see anything obviously wrong. Can you show me the templates and the info you used when adding the module?
  #4  
Old 06-15-2004, 02:27 PM
+decipher +decipher is offline
Junior Member
 
Join Date: Jun 2004
Posts: 8
Default Re: Hoping someone with a PHP and CMPS clue can tell me what's wrong here.

Quote:
Originally Posted by Bryant
There's someone else's thread on a similar issue here, just as an FYI. Still hoping someone can shed some light here, but I'll just be happy when any v3articles->CMPS module is ready.
Since there are a few people working on this I will post what I have accomplished so far. I have approached this in a more "permanent" way, it adds tables to the vbAdvanced settings and everything.

Installer:

Installs settings, phrases, templates and everything. I did it this way so I can turn various options on and off as I see fit.

Options:
Look at the news options in VBA CMPS and I just replicated that. I added a category icon thing and a category title thing as well. I was having some mySQL errors, but once I fixed those it still displayed nothing.

Like I said in my other post, 90% of the code (the installer, and the article.php file) is from the vba cmps files themselves. If Bryan will let me, I will zip everything up with some quick documentation and attach it so someone else can finish it up and get it working.

I really have no idea what I am doing here really, so if I am allowed to post what I have done it would be great.
  #5  
Old 06-15-2004, 07:15 PM
Bryant Bryant is offline
Junior Member
 
Join Date: Mar 2004
Posts: 13
Default Re: Hoping someone with a PHP and CMPS clue can tell me what's wrong here.

Quote:
Originally Posted by +decipher
Since there are a few people working on this I will post what I have accomplished so far. I have approached this in a more "permanent" way, it adds tables to the vbAdvanced settings and everything.

Installer:

Installs settings, phrases, templates and everything. I did it this way so I can turn various options on and off as I see fit.

Options:
Look at the news options in VBA CMPS and I just replicated that. I added a category icon thing and a category title thing as well. I was having some mySQL errors, but once I fixed those it still displayed nothing.

Like I said in my other post, 90% of the code (the installer, and the article.php file) is from the vba cmps files themselves. If Bryan will let me, I will zip everything up with some quick documentation and attach it so someone else can finish it up and get it working.

I really have no idea what I am doing here really, so if I am allowed to post what I have done it would be great.

decipher, I think we're both falling prey to the same problem. Like I said, I was able to get it to spit out the featured article on its own page by running the .php from the /modules directory, but for some reason, it will not work once pulled into the CMPS index.

Brian, appreciate you taking a look, here are the two templates;

adv_portal_blog;
<table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%">
<tr>
<td class="tcat">Featured Blog</td>
</tr>
<tr>
<td class="$getbgrow" align="left" valign="top" width="100%">$articlecontent</td>
</tr>
</table>
<br />

article_cmps;
<span class="smallfont">$feature[postbody] <a href="article.php?a=$featuredarticle[id]">continued</a></span>


The settings I used to create the module were pretty cut and dry. Pointed to the .php file, set it to active, and put "adv_portal_blog,article_cmps" in Templates Used.

Last edited by Bryant; 06-15-2004 at 07:18 PM.
  #6  
Old 06-15-2004, 07:52 PM
Brian's Avatar
Brian Brian is offline
Administrator
 
Join Date: Jan 2004
Location: Georgia, USA
Posts: 34,240
Default Re: Hoping someone with a PHP and CMPS clue can tell me what's wrong here.

I think I may see the problem. You're using the variable $datastore['featuredarticle'] in the code, which indicates that you're trying to pull some cached data from the datastore table. Did you add the 'featuredarticle' field to your specialtemplates array? If not, open your global.php file and look for:

PHP Code:
            'adv_modules',
            
'adv_portal_opts'
Replace that with:

PHP Code:
            'adv_modules',
            
'adv_portal_opts',
            
'featuredarticle'
Let me know if that helps.
  #7  
Old 06-15-2004, 08:07 PM
Shack Networks Shack Networks is offline
Junior Member
 
Join Date: May 2004
Posts: 18
Default Re: Hoping someone with a PHP and CMPS clue can tell me what's wrong here.

That worked fine m8 is there any way of pulling more than one article ?

H
  #8  
Old 06-15-2004, 08:17 PM
+decipher +decipher is offline
Junior Member
 
Join Date: Jun 2004
Posts: 8
Default Re: Hoping someone with a PHP and CMPS clue can tell me what's wrong here.

Think you can take a look at what I am attempting to do as well? Everything that I put in the datastore table is already using the "adv_portal_ops" so I would assume that I wouldn't need to add any other specialtemplates correct?

I fear putting the files up here because the code isn't really mine. I am sure that there might be an easier way to do it, but I like having options. I have no idea what the hell I am doing but I am trying.

Let me know please. I'd imagine that most of the work is already done, I just need to figure out the query to pull all the info correctly and then get it to display.

I guess I will go over some of the info for what I have going on:
New rows in adv_settings

Code:
Var                                   Group         Value   Defaultvalue  Optioncode  Displayorder
portal_article_enablearchive  	adv_portal_article  	2  	2  	   	     18
portal_article_archivepreview 	adv_portal_article 	1 	1 	yesno 	     19
portal_article_maxarticle 	adv_portal_article 	0 	2 	  	     2
portal_article_maxchars 	adv_portal_article 	500 	500 	  	     3
portal_article_catid 	        adv_portal_article 	2 	0 	  	     1
portal_article_allowcomments 	adv_portal_article 	1 	1 	yesno 	     4
portal_article_showavatar 	adv_portal_article 	1 	1 	yesno 	     6
portal_article_articleicon 	adv_portal_article 	1 	1 	yesno 	     7
portal_article_showrating 	adv_portal_article 	1 	1 	yesno 	     8
portal_article_showattachments 	adv_portal_article 	1 	1 	yesno 	     5
portal_article_showsendfriend 	adv_portal_article 	1 	1 	yesno 	     9
portal_article_enablehtml 	adv_portal_article 	1 	0 	yesno 	     10
portal_article_enablevbcode 	adv_portal_article 	1 	1 	yesno 	     11
portal_article_enablevbimage 	adv_portal_article 	1 	1 	yesno 	     12
portal_article_enablesmilies  	adv_portal_article  	1  	1  	yesno  	     13
portal_article_dateformat 	adv_portal_article 	M d, Y - g:i A 	M d, Y - g:i A 	  	     14
portal_article_categorytitle  	adv_portal_article  	0  	0  	yesno  	     15
portal_article_categoryicon 	adv_portal_article 	0 	0 	yesno 	     16
New row in adv_settinggroup
adv_portal_article

2 Rows in adv_modules
Article & Articlearchive (same settings as your news and news archive)

The options sits right underneath the news options in the default settings page for cmps, all the phrases/settings/templates were entered using the vba cmps installer.

If you are too busy to help thats cool with me, I would only need the OK to let someone else help me.
  #9  
Old 06-15-2004, 08:22 PM
+decipher +decipher is offline
Junior Member
 
Join Date: Jun 2004
Posts: 8
Default Re: Hoping someone with a PHP and CMPS clue can tell me what's wrong here.

Quote:
Originally Posted by Shack Networks
That worked fine m8 is there any way of pulling more than one article ?

H
If I can get mine working (and the ok to release it or whatever) it will pull as many articles as you want from as many categories as you want. It will look the same as the news does on an unhacked vba cmps however. I have no knowledge of getting it to look like vbportals does, I tried to do that with the news/forums and it didn't work how I though it would.

I did add the forum icon hack from Livewire to v3articles so it will be able to have category icons/images that are seperate from the users avatar. Handy if you have different categories and are looking for that "nuke" type look I guess.
  #10  
Old 06-15-2004, 08:26 PM
Shack Networks Shack Networks is offline
Junior Member
 
Join Date: May 2004
Posts: 18
Default Re: Hoping someone with a PHP and CMPS clue can tell me what's wrong here.

OK I got it to display and did some template tweeking.

I want to know if theres any way this can be altered to say pull the top 5 latest articles from the database and display them as in the pic I posted.

H
Attached Images
File Type: jpg articles1.JPG (43.4 KB, 76 views)
  #11  
Old 06-15-2004, 08:34 PM
Shack Networks Shack Networks is offline
Junior Member
 
Join Date: May 2004
Posts: 18
Default Re: Hoping someone with a PHP and CMPS clue can tell me what's wrong here.

Maybe also display the first attached image as a thumbnail next to the title and content ?

H
  #12  
Old 06-15-2004, 08:39 PM
+decipher +decipher is offline
Junior Member
 
Join Date: Jun 2004
Posts: 8
Default Re: Hoping someone with a PHP and CMPS clue can tell me what's wrong here.

Quote:
Originally Posted by Shack Networks
Maybe also display the first attached image as a thumbnail next to the title and content ?

H
You could adapt Livewires forumhomeicon hack. Add it to articlecategory, then pull it with your query couldn't you? It wouldn't be very dynamic but you wouldn't have to attach a new pic for every article either.

If I am way off here, I apologize, I have no idea what I am doing.
  #13  
Old 06-15-2004, 11:46 PM
Bryant Bryant is offline
Junior Member
 
Join Date: Mar 2004
Posts: 13
Default Re: Hoping someone with a PHP and CMPS clue can tell me what's wrong here.

Quote:
Originally Posted by Brian
Let me know if that helps.
You're the greatest. It's working fine now. Exactly what I wanted. Thanks so much!
  #14  
Old 06-16-2004, 11:22 AM
Brian's Avatar
Brian Brian is offline
Administrator
 
Join Date: Jan 2004
Location: Georgia, USA
Posts: 34,240
Default Re: Hoping someone with a PHP and CMPS clue can tell me what's wrong here.

You should post this in the Add-On Modules forum.
  #15  
Old 06-16-2004, 12:19 PM
+decipher +decipher is offline
Junior Member
 
Join Date: Jun 2004
Posts: 8
Default Re: Hoping someone with a PHP and CMPS clue can tell me what's wrong here.

Good job Bryant. Glad you made it work for yourself. I am completely stuck on mine. If I put the mySQl query in vba_cmps_include_top.php I don't recieve any errors any more. So at least I got that fixed (I guess). Everything is there, just nothing is being displayed.

I have been messing with this for about 4 days now. Think it's time to give up.
  #16  
Old 06-16-2004, 08:04 PM
Bryant Bryant is offline
Junior Member
 
Join Date: Mar 2004
Posts: 13
Default Re: Hoping someone with a PHP and CMPS clue can tell me what's wrong here.

It's in the User Add-on Modules forum now, here, thanks Brian.

It's also at vb.org here.

Decipher, I know a lot of people would probably be more interested in your implementation. Hopefully you can get it figured out.

If anyone downloaded the .zip I had in this thread, you may need to adjust the template I had in there depending on where you load your CMPS index from. It was missing '$vboptions[bburl]/' before, the current .zip has that, but wanted to point it out. Shouldn't affect most, but in my case, I load my front page from a different subdomain, so I needed that correction.

Last edited by Bryant; 06-16-2004 at 08:07 PM.
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
vBadvanced CMPS Released! Brian Announcements 28 06-13-2004 01:02 PM


All times are GMT -4. The time now is 05:38 AM.

Forums Powered by vBulletin, Copyright ©2000-2009, Jelsoft Enterprises Ltd.
Please note that vBadvanced is in no way affiliated with Jelsoft Enterprises Ltd, nor will Jelsoft be able to provide any support for our products.