setting back the db_query result set - has anyone an idea ???? !!!!!

christian_gnoth - June 15, 2009 - 18:58

Hello,
for my front page I wanted show the latest posts. I am using the follwing statements to get the nodes.

Unfortunately the rest of the front page is no more working. the nodes are not vsisble as before. Drupal normaly shows the nodes on the front page which have the flag "show on front page" on. but with my coding it is no more working.

How can I set back the db cache - or what is the problem?

$sql_string = "SELECT n.nid AS nid,n.created AS node_created,n.title AS node_title,n.type AS node_type " . "\n" .
"FROM {node} n " . "\n" .
"ORDER BY node_created DESC";
$result_query = db_query(db_rewrite_sql($sql_string));

while ( ($node = db_fetch_object($result_query)) && ($counter_head < $head) )

Caching I have deactivated for my website in drupal-admin

no error is displayed - also with the error display flags on

only the last record of the query is displayed on the front page - $content is not filled correctly. how i can set back the query result set ?

Well, you don't need all of

coreyp_1 - June 15, 2009 - 19:21

Well, you don't need all of the . "\n" ., that's for sure, but that's probably not your problem. Is your site still loading? Is it giving you an error message? Although it may not be a WSOD, some of the solutions provided here may be beneficial.

-Corey

- Corey

not the problem

christian_gnoth - June 16, 2009 - 20:34

no, that is not the problem. i can try the hints for getting error output.

but if i remove my query all is working on the front page. with my query the node result set is displayed not the normally nodes with the "show on front page" option.

so the normally query for the front page is not performed.

you can take a look at drupal.it-gnoth.de

I perform a sql query for the headline news with the latest posts. only the last post is shown on the main content for the front page. this post normally has nopt the flag "show on front page".

with regards
Christian Gnoth
+49 176 43098358

still need hints !!!

christian_gnoth - June 19, 2009 - 11:00

has anyone an idea? it is still not solved

with regards
Christian Gnoth
+49 176 43098358

Well, I still can't see where

coreyp_1 - June 19, 2009 - 13:27

Well, I still can't see where there should be any problem, at least not with the information given. Something is either missing from the description, or there is a conflicting setting somewhere. There really isn't any way for us to know.

Just out of curiosity, is there a reason that you're not using Views to generate the list? It would undoubtedly be easier!

-Corey

- Corey

wrong items are visible

christian_gnoth - June 19, 2009 - 16:29

normally the nodes with the 'promote' flag seted in the nodes table should be visible on the front page. but now the latest node from my last query is visible - and this is not a front page node...
it looks like that the normal query is not performed...

with regards
Christian Gnoth
+49 176 43098358

Long shot, but have you

coreyp_1 - June 20, 2009 - 21:15

Long shot, but have you looked into the syntax for db_rewrite_sql()?

What happens if you don't pass the query string through that function?

-Corey

- Corey

not the problem - i am still looking for the reason

christian_gnoth - June 25, 2009 - 13:34

Hello,
the db_rewrite_query function call is correct - even with no call to that function and only call to dq_query the same result.

Now I have found a work-around:

I am now calling the function node_page_default() wich generates the default output for the main section of the front-page.

I am still looking for the reason that the normal front-page output is not generated.

so if anyone has an idea...

with regards
Christian Gnoth
+49 176 43098358

.

grobemo - June 25, 2009 - 13:41

Where exactly are you placing this code? In page-front.tpl.php? In a preprocessor function template.php? In a separate page that you've set as the site's front page?

This is a long shot, but could the problem be that you're overwriting an existing $node variable? Try changing $node in your code about to something like $recent_node.

Another option for achieving what you want would be to use the Views module to create a block of recent nodes and then set that block to display on the front page.

the variable names were the reason

christian_gnoth - June 25, 2009 - 16:51

hello,
thank you for the advice. the variable names were the reasons.

now it is working.

with regards
Christian Gnoth
+49 176 43098358

 
 

Drupal is a registered trademark of Dries Buytaert.