0

I want to import node that are on one page to another programmatically.

Have tried to do by two method

$my_view_name = 'view name';
$my_display_name = 'display name';

$my_view = views_get_view($my_view_name);
if ( is_object($my_view) ) { 
  $my_view->set_display($my_display_name);
  $my_view->$nid;
return $my_view

views_embed_view('Machine name', 'Page name', $nid);

Trying to get all the nodes from one page and use them in another page to do some operations. So in the first page I have written some sql queries to get a node. Now in the second page I want all those nodes without writing the sql queries. So whenever someone updates the first page, the person does not have to go to second page and update the sql queries over there

  • Unfortunately unclear what exactly you are trying to achieve. A view is no content, it's just a layer to display content. Content is in the database. – leymannx Apr 17 at 17:19
  • Trying to get all the nodes from one page and use them in another page to do some operations. So in the first page I have written some sql queries to get a node. Now in the second page I want all those nodes without writing the sql queries. So whenever someone updates the first page, the person does not have to go to second page and update the sql queries over there. – asnique Apr 17 at 18:24
  • And what's that view? – leymannx Apr 17 at 19:08
  • The first page view. – asnique Apr 17 at 19:26
  • In your question's title by page you mean a "Basic page" node, not a different site like example-foo.com and example-bar.com, right? And with importing you mean "displaying", right? That's one and the same page/site you are talking about, right? Just guessing. As it's still absolutely unclear to me. – leymannx Apr 18 at 5:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.