Extension building question

Discuss PivotX 2.0.x extensions here, and view extensions that are available for download.

Extension building question

Postby kenada » Thu May 03, 2012 9:14 pm

First question, is it possible to turn the pages part of pivotX into an extension instead of hard coded into the core?
I will be leaving the original page setting in place but I need all the functions in this section. I have been trying to do this my self have have gotten as far
as adding the new memus, but I can't seem to find the right spot to set the db table for it to read and write to.

Second question, is how can I have the template used in this call
Code: Select all
 renderTemplate('pages.tpl');
pull from extensions folder instead of the templates_internal folder?
This one step is keeping my extension from being in one folder.

Thanks guys, and Kevin God Bless you for PivotX, as much as I love WordPress I love the fact of flat files even more! THANK YOU KEVIN!!!
kenada
 
Posts: 18
Joined: Thu May 03, 2012 8:28 pm

Re: Extension building question

Postby kenada » Thu May 03, 2012 9:29 pm

I found the answer I was looking for.
Code: Select all
$PIVOTX['template']->display($PIVOTX['paths']['extensions_path']."extensionfolder/templatefile.tpl");


But I got something wrong, now on the dashboard when I vistit this page I see Website is OFFLINE | Welcome, unknown user.

Will report more.
kenada
 
Posts: 18
Joined: Thu May 03, 2012 8:28 pm

Re: Extension building question

Postby kenada » Thu May 03, 2012 9:40 pm

Ok now I found how to change the database call.
Code: Select all
$page = $PIVOTX['pages']

Simply change it to this

Code: Select all
$page = $PIVOTX['your_table_name']


So that solves that problem.
kenada
 
Posts: 18
Joined: Thu May 03, 2012 8:28 pm

Re: Extension building question

Postby kenada » Thu May 03, 2012 10:43 pm

Nope it is not pulling the pages from my table, grrrr.....
kenada
 
Posts: 18
Joined: Thu May 03, 2012 8:28 pm

Re: Extension building question

Postby kenada » Fri May 04, 2012 2:22 am

That didn't seem to work this is the fuction I am working on.
Code: Select all
function pagePagesoverview() {
    global $PIVOTX;


I need these pages to load from and save to a different table I have created.
My goal is to make an extension that will give me all the page creation and deletion functions
but work from a different table than the normal pivotx_pages table.

I have my reasons for this but I can't seem to get it right.

I am also having a problem with the pagesbuttons.tpl loading from the extensions folder.
This call is in the pages.tpl which I have also moved to my extension folder.

The call looks like this
Code: Select all
[[include file="inc_pagesbuttons.tpl"]]


This pulls from the pivotx/templates_internal and when I try to change it to a local path it I get a can not fine error.
I hope it doesn't have to be a full path like /home/user/public_html/ect/ect/ becuase that will not help what I am
trying to do.

Can some one help me out? If I am wasting my time I need to know now so I can just hook into the main page
editor which I don't want to do.
kenada
 
Posts: 18
Joined: Thu May 03, 2012 8:28 pm

Re: Extension building question

Postby Harm10 » Fri May 04, 2012 5:47 am

My knowledge of the PivotX structure is not big enough to answer your question. I guess people like hansfn and marcelfw or maybe Bob could help you but they all are very busy. You could try to PM them but no guarantee they'll answer.....

Although you state you have your reasons for wanting to save pages (only the pages or the entries also?) in another table could you elaborate on that? Isn't it an option of just copying them from pivotx_table after editing has been done?
Quality is in the detail of things............

Want to change or update your PivotX site? Mail or PM me!
I can also convert your site to a Wordpress site!
Harm10
Developer
 
Posts: 2011
Joined: Wed Jun 17, 2009 9:37 am
Location: Somewhere in The Netherlands (aka Holland)

Re: Extension building question

Postby hansfn » Fri May 04, 2012 6:47 am

@kenada: It's much better to explain clearly what you are trying to do, and when/if you have some code, post all of it in stead of just some lines here and there. In general PivotX has plenty of hooks for the rendering, but lacks some hooks/an API for manipulating the internals.

PS! Are you using flatfiles or MySQL database? It wasn't were clear...
hansfn
Developer
 
Posts: 3280
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Extension building question

Postby kenada » Fri May 04, 2012 4:08 pm

I am trying to build a marketing package of sorts. I don't want to integrate into the current Page creation system, but however
add a new one that will post all of its data to a new table in the database. The reason for this is because I plan on cloning this
first system and making 2 more that work the same way but have different fields.

I understand I could just hook into the current page creation template and add the fields I want to add but I don't want it this
way because when I make the second part of the system then page creation page will have way to many fields and it will confuse
the user.

I want this extension to be 100% inclusive, this will include the page creation modual but will be independent from the orginal
page creation model.

Does this make sense?

Also I am wanting this to work with both flat files and sql so the user has the choice, how ever flat would be best
as there could be massive traffic hitting some of these pages. The flat file option is what brought me to PivotX and
I would hate to use this option.
kenada
 
Posts: 18
Joined: Thu May 03, 2012 8:28 pm

Re: Extension building question

Postby hansfn » Mon May 07, 2012 7:21 am

It made slightly more sense. It smells like an ugly hack to me ... Of course, you can edit the PivotX core files, but then maintenance becomes a problem (when you need to upgrade PivotX).

I normally try to do things as simple as possible: I would have dropped the requirement about different tables and used the Bonusfields extension to add the extra fields. If you really need separate storage I would have used two PivotX installations.
hansfn
Developer
 
Posts: 3280
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Extension building question

Postby kenada » Mon May 07, 2012 4:07 pm

hansfn wrote: I would have dropped the requirement about different tables and used the Bonusfields extension to add the extra fields.


This is what I have done, only I can't find the documentation on how to use the (Show if condition is met). I want these new fields to only show if they are
editing a page in chapter X. Would be nice if this chapter could be auto created when the plugin is installed but not 100% necessary.

This way I could have 3 different chapters, 1 for squeeze pages, 1 for landing pages and 1 for standard pages. A lot of these settings will be the same
but not all of them will be used in each section. This will help not confuse the user when creating one of these pages with fields they do not need.

That is one of the big things I don't like about WP plugins like the one I am creating. All the settings are jammed into the page editing system and
sometimes when creating a page the user ends up putting all their setting in the wrong section. I hate it when I do it and I don't want my users to
have the same experience. This is why I wanted to try and create a new page creation process. But if I can get the (Show if condition is met)
to work then it will not be an issue.
Last edited by kenada on Mon May 07, 2012 10:52 pm, edited 1 time in total.
kenada
 
Posts: 18
Joined: Thu May 03, 2012 8:28 pm

Next

Return to 2.x Extensions

Who is online

Users browsing this forum: Google [Bot] and 2 guests

cron