By mattwmc on
I'm transferring a site into drupal but its going to take a really long time.
Meanwhile, new pages that are created are now using drupal.
I created a view/block to display recent pages from a node in the sidebar and use this code to display:
<?php
$view = views_get_view('viewname');
print $view->execute_display('default', $args);
?>
Works great for the Drupal pages, but (as the sidebar shows up in non-drupal pages) I get this error:
Fatal error: Call to undefined function views_get_view() in /home/content/xxx/html/sidebar.php on line 92
I suppose its not reading the drupal database or whatever, is there a way to fix that?
Comments
You'll need to include a file
You'll need to include a file to be able to use the drupal api and call drupal_boostrap(
Check to your path on the include I just put that in as a possible path 'includes/bootstrap.inc
http://api.drupal.org/api/function/drupal_bootstrap/6
Thanks for the reply. So are
Thanks for the reply.
So are you saying to use this?
However, I get an error:
Not sure but seems like
Not sure but seems like bootstrap is running and drupal starts to load but is confused by its path which is no longer what it expects
You may have to -- before calling drupal_bootstrap
or see http://drupal.org/node/94077
That's what I thought as
That's what I thought as well.
This is the line (1009) in the boostrap.inc the error is referring to (I think)
I wonder if its because I don't have drupal installed in the root (/cms/drupal).
Maybe I can bump
Maybe I can bump this...anyone?
Sorry this got buried on
Sorry this got buried on me.
Before loading bootstrap you could try and set your include path so that when bootstrap load it will be able to include its includes
Thanks for replying. Doesn't
Thanks for replying.
Doesn't matter now as I moved drupal into the root and am in the process of moving everything over - if only I could get into Drupal Admin, lol.
That's for the other thread, though, lol.
I need to do the same thing,
I need to do the same thing, if anybody knows how. I want to display a block on our display screens, rotating news and events.
I've got as above,
It falls over at drupal_bootstrap, the includes seem to be ok. Any help gratefully received!
Subscribing, interested in
Subscribing, interested in this also!
Greetings, Martijn
Yeah, I still can't get it to
Yeah, I still can't get it to work with any of the above.
Anyone?
The solution is to execute a
The solution is to execute a chdir first:
Awesome! That's it! However,
Awesome!
That's it!
However, I get a conflict (I think) with a require_once code I have to show forum posts from Simple Machine Forums on some pages:
require_once('/home/content/xxxx/html/forum/SSI.php');ErrorL
Is there a work around? No big deal for me if there isn't, I can eliminate the SMF code. Thought I would ask.
Spoke to soon. For some
Spoke to soon.
For some reason it is changing the links and adding to it.
For me its adding /reviews/ to all links.
Example - link is supposed to be /news/newsoftheday but coming out /reviews/news/newsoftheday
Thank you so much that works
Thank you so much that works great!
It does rewrite the drupal url to be whatever directory I call the script from, but I can rewrite the links or remove them as it's only for display screens.
w00t!
Yes, I think that is whats
Yes, I think that is whats happening for me.
Its writing the url as if its in the directory of the page the code is found on.
Is there a fix to print the exact url?
For example, if I put the code on a page inside the 'articles' directory it will print the url as /articles/node
instead of /node.
This worked like a charm for
This worked like a charm for me, many thanks. I feel I just opened up a door to a huge new dimension.
ALSO: Make sure "DOCUMENT_ROOT" is in big caps. Small caps doesn't work for me.
I'm on Windows Server 2003, Drupal 5, PHP 5.2
Another tip, you may need to
Another tip, you may need to chdir again to get back to the proper working directory so things like image paths may work properly.