<![CDATA[ [plugin] Blog ping - for testing - My Forums]]> https://forums.modx.com/thread/?thread=35873 <![CDATA[Re: [plugin] Blog ping - for testing]]> https://forums.modx.com/thread/35873/plugin-blog-ping---for-testing#dis-post-200632 Bjarne Sep 18, 2008, 02:34 PM https://forums.modx.com/thread/35873/plugin-blog-ping---for-testing#dis-post-200632 <![CDATA[Re: [plugin] Blog ping - for testing]]> https://forums.modx.com/thread/35873/plugin-blog-ping---for-testing#dis-post-200631
cheers
Simon]]>
simonok Sep 16, 2008, 07:50 AM https://forums.modx.com/thread/35873/plugin-blog-ping---for-testing#dis-post-200631
<![CDATA[Re: [plugin] Blog ping - for testing]]> https://forums.modx.com/thread/35873/plugin-blog-ping---for-testing#dis-post-200630 dev_cw Sep 16, 2008, 06:14 AM https://forums.modx.com/thread/35873/plugin-blog-ping---for-testing#dis-post-200630 <![CDATA[Re: [plugin] Blog ping - for testing]]> https://forums.modx.com/thread/35873/plugin-blog-ping---for-testing#dis-post-200629
It’ also has a more intuitive way of displaying sites to ping, checkboxes instead of char separated text. Haven’t tried it out though.]]>
Bjarne Sep 16, 2008, 12:50 AM https://forums.modx.com/thread/35873/plugin-blog-ping---for-testing#dis-post-200629
<![CDATA[Re: [plugin] Blog ping - for testing]]> https://forums.modx.com/thread/35873/plugin-blog-ping---for-testing#dis-post-200628 this sendping plugin in their functionalities ?]]> tkfmnet Sep 15, 2008, 09:52 PM https://forums.modx.com/thread/35873/plugin-blog-ping---for-testing#dis-post-200628 <![CDATA[ [plugin] Blog ping - for testing]]> https://forums.modx.com/thread/35873/plugin-blog-ping---for-testing#dis-post-200627
Other solutions can be found in this thread http://modxcms.com/forums/index.php/topic,26691.0.html.

This plugin uses a template variable where you can define which sites to ping, you can have a default value of several sites but also add sites as you write your content. Note though, that this is not a pingback or a trackback thingy, but it can be useful to be able to ping different searchengines.

In my case I use a specific template only for blog posts, so I check the current document template and if it’s my blog post template then execute the pings, otherwise nothing happens.
It would be easy to alter the DBAPI select call to execute ping on all templates that carries the TV, if that’s what you want.

The PHP code might not be the pretteist, since I’m rather new on PHP. There is also a few drawbacks, like saving a document (the plugin is written for "OnDocFormSave") might take some time, if you have a lot of sites to ping.
Also, if a ping returns an error, sometimes you recieve a HTTP 500 error and the plugin might stop pinging remaining sites. This is probably a result of my so far rather poor PHP knowledge, so if anyone knows why and how to correct this please reply.

So this is how you set it up:

1. Create a folder in assets/plugins called "ping", and add the file xmlrpc.inc into the folder.

2. Create a TV called "Ping". It should be a Textarea.

If you want, add some sites to ping as defalut value. The information needed for a site is address, path and port. For example, for Googles blog search the address is blogsearch.google.com the path is /ping/RPC2 and the port i 80. So you add this information, separated with a ";". Like:

blogsearch.google.com;/ping/RPC2;80

If you want to add more, separate them with a ",". Like:

blogsearch.google.com;/ping/RPC2;80,rpc.twingly.com;/;80

3. Copy the text in blogping.php and add it into a new plugin, call it BlogPing or what you want. Don’t forget to connect it to OnDocFormLoad on the system events tab.

Alter the row

$templateid = 4;

to fit your template.

If you want to make a ping on every template that has the TV, remove that row and alter the row:

$result = $modx->db->select("default_text", $tbl_tv. ’ INNER JOIN ’ . $tbl_tv_temp . ’ ON ’ . $tbl_tv .’.id=’ . $tbl_tv_temp . ’.tmplvarid’,$tbl_tv.’.Name=\’Ping\’ AND ’ . $tbl_tv_temp .’.templateid=$templateid);

to

$result = $modx->db->select("default_text", $tbl_tv. ’ INNER JOIN ’ . $tbl_tv_temp . ’ ON ’ . $tbl_tv .’.id=’ . $tbl_tv_temp . ’.tmplvarid’,$tbl_tv.’.Name=’Ping’’);

And thats it, I think.

(Errors and successfull pings are recorded in the system eventlog.)

]]>
Bjarne Sep 15, 2008, 02:34 AM https://forums.modx.com/thread/35873/plugin-blog-ping---for-testing#dis-post-200627