Lasts Articles in the Site

Postby jondaley on Wed Sep 19, 2007 6:02 pm

you mean if you print a hello below the getBlogCategories() line, nothing shows up?
You'll probably need to ask your host to find out what the real error is. They should make php errors available through the error log.

You can also try putting print hello statements in class/dao/articlecategories.class.php in the getBlogCategories() function (note that this will cause "hello"s to appear on your blog.
jondaley
Lifetype Expert
 
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

Postby italian_user on Thu Sep 20, 2007 7:57 am

Yes! like You told!
If I run this code:
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>TestPage</title>
</head>
<body>
<?php
print "hello1";
define( "PLOG_CLASS_PATH", "/home/public/blog/" );
print "hello2";
include_once( PLOG_CLASS_PATH."class/bootstrap.php" );
print "hello3";
lt_include( PLOG_CLASS_PATH."class/dao/articlecategories.class.php" );
print "hello4";
include_once( PLOG_CLASS_PATH."class/summary/dao/summarystats.class.php" );
print "hello5";
lt_include( PLOG_CLASS_PATH."class/dao/articles.class.php" );
print "hello6";
$categories = new ArticleCategories();
print "hello7";
$allCategories = $categories->getBlogCategories(1);
print "hello8";
foreach( $allCategories as $category ) {
print "hello9";
print("Category: " . $category->getName() . "<br/>");
print "hello10";
$articles = new Articles();
print "hello11";
$maxArticles = 5;
print "hello12";
$lastArticles = $articles->getBlogArticles(
1,  // blog id, change this if your blog id is not '1' but something else
-1, // no date limit
$maxArticles, // only 5, as defined above!
$category->getId(), // any category
POST_STATUS_PUBLISHED ); // only articles with published status
print "hello13";
// now loop through them to display whatever we need
print "hello14";
foreach( $lastArticles as $article ) {
print "hello15";
$blogInfo = $article->getBlogInfo();
print "hello16";
$reqGen = $blogInfo->getBlogRequestGenerator();
print "hello17";
print("<a href='".$reqGen->postPermalink($article)."'>".$article->getTopic()."</a><br/>");
print "hello18";
}
}
?>
</body>
</html>


I have this result:

hello1hello2hello3hello4hello5hello6hello7



The hosting doesn't have code of error in the log_file... but automatically is created a file "core.223455" (the numbers changes at every files)

:roll:

thanks more

PS. SORRY FOR MY QUESTION.. Can You run this code in your LT blog?
italian_user
 
Posts: 193
Joined: Mon Apr 03, 2006 1:37 pm
LifeType Version: 1.2.11

Postby jondaley on Thu Sep 20, 2007 10:49 am

output on my server:
hello1hello2hello3hello4hello5hello6hello7hello8hello9Category: General
hello10hello11hello12hello13hello14hello15hello16hello17Always Assume the Best
hello18hello15hello16hello17Calendar History
hello18hello15hello16hello17Camping and Fishing
hello18hello15hello16hello17Vacation and Back, Plus Random
hello18hello15hello16hello17Beauty, Makeup, Hair
hello18hello9Category: Reviews ...
jondaley
Lifetype Expert
 
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

Postby italian_user on Thu Sep 20, 2007 11:58 am

jondaley wrote:output on my server:
hello1hello2hello3hello4hello5hello6hello7hello8hello9Category: General
hello10hello11hello12hello13hello14hello15hello16hello17Always Assume the Best
hello18hello15hello16hello17Calendar History
hello18hello15hello16hello17Camping and Fishing
hello18hello15hello16hello17Vacation and Back, Plus Random
hello18hello15hello16hello17Beauty, Makeup, Hair
hello18hello9Category: Reviews ...



thanks very very much...
So, I told my hosting that the code is ok and in my site doesn't work.

He told me that:
"The file being generated 'core' shows a coding issue. This does not necessarily mean the coding is wrong but the variables are not being declared properly against the system ones. Does your script require any specific dependencies in the Apache/PHP build?"

What have we need?
What have I to reply?
Thanks.. I hope these are the last post about this my problem... :oops:
italian_user
 
Posts: 193
Joined: Mon Apr 03, 2006 1:37 pm
LifeType Version: 1.2.11

Postby jondaley on Fri Sep 21, 2007 12:15 am

I don't know how to cause a core dump in php.
This code is pretty simple, and shouldn't cause a core dump any more than the lifetype blog would cause one, and I assume you aren't getting any core dumps there.

You probably need to put hello statements in the lifetype code as I suggested a post or two ago.
jondaley
Lifetype Expert
 
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

Postby phunkphorce on Fri Sep 21, 2007 5:07 am

Can you ask your hosting to upgrade to a newer version of PHP?

Are you running an opcode cache for PHP? If so you could ask your host for instructions on how to disable it, as it is known to have caused issues in the pasts...
phunkphorce
Lifetype Expert
 
Posts: 9028
Joined: Mon Aug 25, 2003 6:34 am
Location: Suomessa

Postby jondaley on Fri Sep 21, 2007 11:32 am

Ah, good thought - I have seen eaccelerator and friends cause crashes.
jondaley
Lifetype Expert
 
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

Postby italian_user on Sun Sep 23, 2007 5:44 pm

jondaley wrote:Ah, good thought - I have seen eaccelerator and friends cause crashes.


Thanks guys!
I'm waiting for them reply..
I'll come back soon (I wish) and I'll tell You everything!
italian_user
 
Posts: 193
Joined: Mon Apr 03, 2006 1:37 pm
LifeType Version: 1.2.11

Postby italian_user on Mon Sep 24, 2007 8:01 am

Hi!
This is the reply:

"The code is parsed everytime it is requested, it is not cached on the server side"

:oops: What is means?

thanks more
italian_user
 
Posts: 193
Joined: Mon Apr 03, 2006 1:37 pm
LifeType Version: 1.2.11

Postby jondaley on Mon Sep 24, 2007 10:27 am

I assume that means they aren't running an accelerator or zend optimizer, etc. but I can't be sure. I think you need to put the print statements inside the function that is dying to try to track it down further.
jondaley
Lifetype Expert
 
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

Postby italian_user on Wed Sep 26, 2007 3:41 am

jondaley wrote:I assume that means they aren't running an accelerator or zend optimizer, etc. but I can't be sure. I think you need to put the print statements inside the function that is dying to try to track it down further.


thanks for your reply.
:roll: I can remember that it's running "zend optimizer" :!:
I'm very sure of this 'cause long time ago I had some problems with "zend opt."

So, if You need I'd to print statements inside the funtcion... I'll try that...
But I'm not a girl very expert in the php...

:oops: :oops: :oops: :oops:
italian_user
 
Posts: 193
Joined: Mon Apr 03, 2006 1:37 pm
LifeType Version: 1.2.11

Postby italian_user on Tue Oct 09, 2007 7:50 am

I'm glad to inform You that the problem is been fixed!!
The problem is not the code... but ZEND OPTIMIZER!!!
I disabled it and now the code works very well!!
Thanks very much for your support!

Now.. I'm a little little problem...
the code show tthe categoy and the last posts in the categories of ONE BLOG...
Code: Select all
$allCategories = $categories->getBlogCategories(1);


I'd like to show last articles of all blogs..
like the main column in the summary page... :oops:
italian_user
 
Posts: 193
Joined: Mon Apr 03, 2006 1:37 pm
LifeType Version: 1.2.11

Postby phunkphorce on Tue Oct 09, 2007 8:10 am

italian_user wrote:I'd like to show last articles of all blogs..
like the main column in the summary page... :oops:


If summary.php is already doing what you want, why don't you have a look at the code of the summary and see how we do it? Then it's only a matter of copy and paste (hint: look in class/summary/dao/summarystats.class.php)
phunkphorce
Lifetype Expert
 
Posts: 9028
Joined: Mon Aug 25, 2003 6:34 am
Location: Suomessa

Postby italian_user on Tue Oct 09, 2007 5:53 pm

phunkphorce wrote:
italian_user wrote:I'd like to show last articles of all blogs..
like the main column in the summary page... :oops:


If summary.php is already doing what you want, why don't you have a look at the code of the summary and see how we do it? Then it's only a matter of copy and paste (hint: look in class/summary/dao/summarystats.class.php)


thanks very much..
I created the new code.. but I have some problem...

Code: Select all
<?php
define( "PLOG_CLASS_PATH", "../blog/" );
include_once( PLOG_CLASS_PATH."class/bootstrap.php" );
lt_include( PLOG_CLASS_PATH."class/dao/articlecategories.class.php" );
include_once( PLOG_CLASS_PATH."class/summary/dao/summarystats.class.php" );
lt_include( PLOG_CLASS_PATH."class/dao/articles.class.php" );
lt_include( PLOG_CLASS_PATH."class/dao/globalarticlecategories.class.php" );

$categories = new ArticleCategories();
$allCategories = $categories->getBlogCategories(0);

foreach ($from=$globalArticleCategories; $item=globalArticleCategory) {
echo'<span class="tag">';
if ($globalArticleCategory->getId() != $globalArticleCategoryId)
echo'<a style="font-size: {$fontSize}px" href="?op=Summary&amp;globalArticleCategoryId='.$globalArticleCategory->getId().'">'.$globalArticleCategory->getName().'</a>';
else
echo'<span style="font-size:'.$fontSize.'px">'.$globalArticleCategory->getName().';
echo'</span>';
}
?>


it doesn't run.. :(

thanks more
italian_user
 
Posts: 193
Joined: Mon Apr 03, 2006 1:37 pm
LifeType Version: 1.2.11

Postby phunkphorce on Wed Oct 10, 2007 4:02 am

And why doesn't it run?

I'm sorry but we don't have time to test your code. If you're messing with custom code, you should be able to debug it yourself too. This is what I would do:

- Do you get an error code in your browser screen?
- If you don't (i.e. you get a blank screen), have you had a look at the source of the generated page and see if the error message is there? Sometimes they're not printed.
- If there's no error message, then have a look at your apache's error_log file. It could be that your hosting provider has configured PHP to only report errors to the apache error_log file, so you'll only find them there.

Once you've found your error, go back to your code, fix it and try again.
phunkphorce
Lifetype Expert
 
Posts: 9028
Joined: Mon Aug 25, 2003 6:34 am
Location: Suomessa

Previous

Return to Requests and Suggestions

cron