Datafeedr Support Forums

Datafeedr Support Forums (http://www.datafeedr.com/forums/index.php)
-   Questions (http://www.datafeedr.com/forums/forumdisplay.php?f=67)
-   -   Embedding a View in a .php page (http://www.datafeedr.com/forums/showthread.php?t=3563)

patagonia January 9th, 2011 09:55 PM

Embedding a View in a .php page
 
Along the same lines as you have the option to "embed a view in a post"... I want to do the same thing, but need the php code, to be able to embed a view, from within the php code of a page (if this is possible).

So what I want to be able to do:

On some sites, it would be nice to have my datafeedr store categories outputted above my latest blog posts.
So instead of the home page of my site, pointing at the datafeedr store homepage, I want to have the home page of my site, be my latest blog posts, but above those, output my datafeedr store categories. I would have to go into the main.php file or whichever one it is, and add the code to output a custom view, above the latest posts loop.

Is this possible? :)

Eric January 9th, 2011 10:33 PM

Hi

Yes, it's possible and pretty straightforward.

The first thing you need to know about is this:
PHP Code:

<?php echo datafeedr_tag(); ?>

That function will display most of your views (doesn't currently work with widgets at this time) anywhere on your site when called from your .php files.

Here are a few examples:

This embeds your store's homepage anywhere you want (not sure how useful that is):
PHP Code:

<?php echo datafeedr_tag("home"); ?>

Embed a product details page for a single product:
PHP Code:

<?php echo datafeedr_tag('product?p=850801159528968')?>

With this you can embed a category list:
http://www.datafeedr.com/forums/show...65&postcount=2

Or you can embed any custom view that you create by following this pattern:
PHP Code:

<?php echo datafeedr_tag("Custom View Name"); ?>

Embed a category page anywhere in your .php files:
PHP Code:

<?php echo datafeedr_tag("category?c=514253"); ?>

Embed your Sales Items custom view anywhere:
PHP Code:

<?php echo datafeedr_tag("Sale Items"); ?>

The real power is when you create new custom views to handle small tasks such as displaying a category list.

Eric

patagonia January 9th, 2011 10:44 PM

Great I look forward to being able to do that.
After all the playing around tonight, I have a lot more questions... but they will have to wait until manana. 1am and bed is calling.

pnewcomb March 7th, 2011 08:45 PM

I'm having trouble with this.

I'm using the tag:
PHP Code:

<?php echo datafeedr_tag("Custom View Name"); ?>

with my custom view in there, and it's setup to show 3 columns of 6 products. The problem is that it's showing the full product image, details, and everything, without the css styling and truncation. What am I doing wrong? My site is http://www.example.com and it's the part below the featured area and to the left.

Eric March 7th, 2011 08:58 PM

Hi

You need to go here: The Factory > Your Store > VIEWS > CUSTOM VIEWS > Custom View Name > View Properties and add view to the Custom CSS ID field.

Eric

pnewcomb March 7th, 2011 09:06 PM

Thanks Eric, that worked like a charm!

fuzzone April 11th, 2011 08:37 AM

Hi!
I tried to add
Quote:

<?php echo datafeedr_tag("home"); ?>
to my home page, but getting this
Quote:

Fatal error: Call to undefined function datafeedr_tag() in /homepages/29/d161728157/htdocs/diamond-connoisseurs/wp-content/themes/default/home_page.php on line 244

Eric April 11th, 2011 09:02 AM

Quote:

Originally Posted by fuzzone (Post 19827)
Hi!
I tried to add to my home page, but getting this

What version of the plugin are you using?


All times are GMT -5. The time now is 09:53 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.