IPB simple hook creating - forum

i have some expirience with creating modifications for many forums but i creating plugin for IPB first time. I want to see example like: how to create plugin which will add some text in header template or something like that.
Thanks for help!

Related

Grav - Parse URL

I want to define a new template called "product".
This template calls an external service and retrieves the information about that specific product. That is easily done with a custom plugin that access the product information. Information on how to do that has been found here.
However, I would like that the URL of the page would be something like:
/product/<id>/<seo-friendly-description>
So I can retrieve in the Twig template both <id> and <seo-friendly-description> which will be used later to retrieve the specific product information.
I have tried to find something that could help in the documentation, without success. Could someone either point me to the right doc section or highlight the basic steps that shall be achieved so I can start solving this issue?
Just in case it helps, I am trying to find something similar to how bottle or other web frameworks work:
#route('/hello/<name>')
def greet(name):
return 'Hello ' + name
I've been building a family recipebook into my own website and I've been working through a similar problem. I haven't quite worked out all the kinks, but my solution is mostly working if you want to checkout my github repo.
In short, you need the plugin to watch what the active route is. If the route matches, you then create the page and populate it using your plugin data.
I haven't quite figured out how to get the active page to highlight in the navigation menu for generated pages, but you might still find this solution helpful.

Modx script after package installation

I need to write a plugin that needs to create table in database and some setting from installation form. I can easily create form but I have difficulty to run the script after installation to read options and create table. Is it possible at all to run such simple script or maybe you need to create everything like for example models, vehicles and so on?
I would appreciate if anyone could give me directions how to do it. Modx documentation is not clear about this and https://github.com/splittingred/Doodles/tree/production sample repo contains multiple elements I'm not familiar with and I believe don't need at all
Typically you'd use a resolver to run code after the install.
While in the question comments the setup options are discussed, the package attributes there are actually executed to generate the setup options form, not to process the results.
The docs are a tad dated (mostly the screenshots), but Creating a 3rd party build script explains the different parts of a build script, and what they're for, with a fair bit of examples.
The piece you're looking for is this:
$vehicle->resolve('php',array(
'source' => $sources['resolvers'] . 'setupoptions.resolver.php',
));
You'll need to have a $vehicle (perhaps from a category or other object you're adding to the build) and the file in the provided location. Inside the resolver file you can use $object->xpdo as an instance of the modX class to do your thing.

How to override View & Template

I m checking horizon documentation at docs.openstack.org/developer/horizon/.
what I am trying to do is to add more information on volumn detail page. I want create that page as tabbed page, show the current information as well as new information. Add tab, which will refreshed with regular interval.
My question is Can I do that without changing openstack code & by extending. If yes, then how can I do that. I dont want code here, but some guidance on how I am creating tab & moving existing info in one tab.
Thanks
Aniruddha
I had to do something similar for loadbalancers panel where we wanted to modify some existing tabs and also add couple of new tabs. Also, we wanted to make our changes available as a PIP package that anyone could install easily.
Checkout the repository available at https://github.com/avinetworks/avi-horizon-dashboard/
The README describes the changes users have to make in their local_settings.py to get this new code included into horizon.
Particularly, check this file that has code to weave in the code from this package into the existing horizon code:
https://github.com/avinetworks/avi-horizon-dashboard/blob/master/avidashboard/dashboards/project/init.py

Modx - Extend site_content - Add new table

Currently, we're running revolution 2.2. On site_content, we have some tags that are ran for crawling twitter. I want to start tracking the number of results for each tag as results come in, to determine which tags don't return that many results, etc.
So I was thinking that I should create a new table (twitter_data), and have a foreign key that will link it to the search tag ID, which is stored in site_content.
What is the best path to accomplish this? Should I create my table then run the reverse schema tool, outlined here?
http://rtfm.modx.com/display/revolution20/Reverse+Engineer+xPDO+Classes+from+Existing+Database+Table#ReverseEngineerxPDOClassesfromExistingDatabaseTable-CreatingaMySQLtable
I also found this, but not sure if this is what I should be looking into:
http://rtfm.modx.com/display/revolution20/Using+Custom+Database+Tables+in+your+3rd+Party+Components
Probably not - if you can avoid modifying the core modx schema do so. an external table may be your best option, but requires a fair bit of work.
though if you can explain wht you mean by 'tags' a little better [html tags? snippets? content tags? not sure what you mean] there may be other options. for example. one of our clients wanted to count page hits [and didn't want to use google to do it] so all we did was to create a template variable bound to each page they wanted to count and then updated that appropriate variable by writing plugin to fire on the onpageload or onpagerender event. [I don't ermember exactly which or what it was called]
Basically, you may be able to do this by writng a plugin rather than trying to extend anything or add snippets/chunks.

predefine template for new resource/document

I would like to set the new child documents to default to a set template that is different from the parent.
I've looked through managermanager, but looks like it is unable to do this.
mm_inherit can only inherit from a parent and mm_default does not support template
ok, so I finally decided to get my hands dirty and put some code together for this.
Initially I had a a bit of disbelief that this wasn't available already.
so it comes down to two things that are required one is a plugin and the other is a TV
In the tv you select all the templates from the database, which you can use to set child documents. Then in the plugin you use the on document form prerender to see if the child template TV is set, and apply it if it is. Voila.
After working on the plugin for a bit, I was trying to get the #SELECT to work for the tv, I came across a post on modx forums, which lead me to this ->
http://modxcms.com/extras/package/?package=214
So I ended up replacing my plugin, I wish I came across this sooner (nevertheless, still good way to learn)

Resources