I'm not sure if there's actually something not working here or if it's just me not knowing how to do it.

I just downloaded 7.x-3.x-dev a couple of hours ago.

(Actually I installed the 7 alpha release first, but then I saw some threads recommending dev instead (perhaps the alpha one should be removed from the downloads list now? or is that a silly idea?) So it wasn't a completely clean install of the dev one, it asked for some kind of database update after it arrived. Including that point for completeness although it seems unlikely to be the issue.)

I've made a view whose machine name is 'current_overview'.

When I'm looking via the Views module's "Auto preview", I can see the nodes it's currently selecting. So I believe the View itself is working.

Now I want the result to appear in a page.

I've installed and switched on the module 'Embed Views Display', which AIUI is the source of the views_embed_view function. (In D6 I was using Insert Views, with the [view:whatever] instruction, so this is the first time I've used the Embed module.)

In a node, I have text:
===
test. A view will go here.
views_embed_view('current_overview')
test test
===
and for this node I have chosen text format 'PHP code'.

Currently the visible result is
===
test. A view will go here. test test
===

i.e. my PHP snippet is not producing anything.

As an experiment, I also tried adding in the function's second parameter (despite guessing it's probably optional if you want the default view), as follows:
views_embed_view('current_overview','default')
but that made no difference.

Any obvious bloopers there? Or any suggestions of what to try next?

Thanks in advance for clues :-)

Comments

dawehner’s picture

Status: Active » Fixed

There is a reason why you should't use php there :)

What you miss is to print the actual output.

print views_embed_view('current_overview') 
Jennifer_M’s picture

Title: Trying to use views_embed_view function, not succeeded yet » Using views_embed_view function

Aaah thanks. Yes I was under the wrong impression that the function included printing it out. Works now!

There is a reason why you should't use php there :)

There is?

::puzzled::

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.