1 rlyeh Aug 14, 2009 13:05
3 edb Aug 16, 2009 00:25
I think what rlyeh is looking for would need to be a rather special plugin because the "added content" would be set once and left alone for all time. So blog posts made during a snowstorm in the winter would always show that it was snowing on that day.
The basics of the plugin would go something like this: it would not be a renderer because it would hook into AdminBeforeItemEditCreate so that it could grab the weather and append it to the post. The post then gets stored in the database with content not actually written. If you are inclined to use draft mode and "publish now" then it gets trickier because the item would be created on day one but published on day seven maybe ... with the weather from day one.
Alternatively, a plugin that makes a toolbar with (lets just say) 7 or 8 buttons for different types of weather. Each button gives you kinda like the videoplug plugin does - like it adds [weather:rainy:NNN] where NNN is the temperature at the moment you are actually publishing the post. In this case your plugin would be both a toolbar maker and a renderer.
Neat idea :)
4 rlyeh Aug 18, 2009 00:05
EdB wrote:
I think what rlyeh is looking for would need to be a rather special plugin because the "added content" would be set once and left alone for all time. So blog posts made during a snowstorm in the winter would always show that it was snowing on that day.
As always, you're spot on! :)
If anyone knows how to make such a plugin, I think it would be most welcome, especially for the "personal" blogs. Meanwhile I'll try to get some silly and ugly hack done, which most likely will break everything ;)
Neat idea :)
Thanks! And thanks for being helpful! :)
5 edb Aug 19, 2009 20:20
What are you using for a weather source? More to the point, what does the end result look like? Meaning does it make a text file or some sort of xml thingie? Or is it some sort of flashy weird thing that takes arcane lore to tease secrets out of?
I'm hella busy (touching my private bits and giggling, thanks for asking) but if it was me I'd probably go with the second method. Pick a general weather type from a dropdown and add a wee bit of text in with what it makes. I'd use a combination of my creative commons plugin and the original videoplug as source material, then figure out how to get it to render the created bit once before storing in the database. Not sure of any existing plugins that do that to post content, but it can't be too hard. Plenty of hookage to play with.
Oh and I'd do it on 247 even though there is something officially 'stable' in the 3.* universe now.
6 yabba Aug 19, 2009 22:51
7 edb Aug 21, 2009 03:40
¥åßßå wrote:
(un)filteritemcontents() ... renderers will make new shit whenever the cache is cleared ;)
¥
Okay this is a bit weird. Recently I discovered how to make my comment-altering plugins not permanently alter comments. topanga had / has an issue with one of my plugins colliding with one of yours is the thing. So in killer bees I fixed it, which means that one no longer permanently alters comments ... and since (I think) comments don't cache that means the server has to do the rendering thing each time each comment is loaded. Oh well, as it will eventually fix the issue topanga had. Unfortunately that means it'll probably bring up another issue, but that is beside the point.
For this I'm thinking of going the other way: the toolbar would pop in something that would get permanently rendered into something else. Like, before the post content is committed to the database. So all future rendering by this plugin wouldn't have something to tinker on. The tinkerable bit would be gone is what I mean.
Anyway I randomly decided the flags project is kinda neat. I've got something like 214 flags done, which is pretty good I guess, but now I decided maybe 16 high isn't good enough for insertion into a post, so maybe I should do it all again only save the 16s and add an option for 32s. Cuz my theory on plugins says more settings covers for lame coding.
But this will be fun. Tomorrow I try again to talk my first actual client into going live with what we have. So I'm kinda thinking something different to do would be groovy. I wish I still had all the open source weather icons I used to have. That'd be a groovy start eh?
DISCLAIMER: I have no idea what I'm talking about :D
8 rlyeh Aug 28, 2009 12:32
EdB wrote:
What are you using for a weather source? More to the point, what does the end result look like? Meaning does it make a text file or some sort of xml thingie? Or is it some sort of flashy weird thing that takes arcane lore to tease secrets out of?
I'm hella busy (touching my private bits and giggling, thanks for asking) but if it was me I'd probably go with the second method. Pick a general weather type from a dropdown and add a wee bit of text in with what it makes. I'd use a combination of my creative commons plugin and the original videoplug as source material, then figure out how to get it to render the created bit once before storing in the database. Not sure of any existing plugins that do that to post content, but it can't be too hard. Plenty of hookage to play with.
Oh and I'd do it on 247 even though there is something officially 'stable' in the 3.* universe now.
I'm sorry for the long absense.
After the image upload-bug I downgraded to 2.* again. As for the weather source, I hadn't really made up my mind, I was thinking most in the lines of a php include from a text file somewhere (really just parse my local weather.com page and add some design tags as a cron job or whatever).
However, I didn't really want a plugin/menu-thing, what I originally visioned was a background job that automatically insertet the contents from the parsed file into the SQL post, in the bottom of the post. I know this would then be a universal setting for all blogs and all posts, but that's actually just what I'm after.
So, it should be something like a php include, done in the background.
9 rlyeh Oct 24, 2009 05:57
I've now got a file containing the information i'd like to "buttonize" (i.e. I can click a button and it will print the contents of the file into the blogpost, like "today it was 7 degrees warm, wind from the north".)
In the plugins/_quicktags.plugin.php I've got the following code:
echo '<input type="button" id="codespan" title="'.T_('klima').'" class="quicktags" onclick="klima_tag(\'\');" value="'.T_('klima').'" />';
?>
<script type="text/javascript">
//<![CDATA[
function klima_tag( lang )
{
tag = '<?php echo ("http://www.servername.ex/file.id/")?>';
textarea_wrap_selection( b2evoCanvas, tag, '', 0 );
}
//]]>
</script>
This gives me a nice "klima"-button, and pressing it prints the http address above. However, when I try to change "php echo" into "php include", then nothing happenes when I click the button.
I know this is no longer b2evolution relevant, but if someone might shed some insight why the php include does not work, I'd be very happy & grateful. Thanks.
All the best, C
10 rlyeh Oct 25, 2009 02:37
OK, found the solution, posting it here in cause someone else wants it:
In the plugins/_quicktags.plugin.php i have added the following:
echo '<input type="button" id="codespan" title="'.T_('klima').'" class="quicktags" onclick="klima_tag(\'\');" value="'.T_('klima').'" />';
include 'http://www.mydomain.net/path/file';
?>
<script type="text/javascript">
//<![CDATA[
function klima_tag( lang )
{
tag = '<?php echo ("$klima_naa") ?>';
textarea_wrap_selection( b2evoCanvas, tag, '', 0 );
}
//]]>
</script>
the include file contains:
<?php
$klima_naa = "whatever the script outputs";
?>
One quick dirty trick is to open your skin index.main.php file and put an 'include' file command that reads the javascript with the weather bit.
or you can just paste the text, javascript or php code you want to include.
you can post it at the top of the article, or at the bottom.
you can also consider html widgets on the sidebar to show such content. there's also a php widget (html widgets can also include javascript)
check out our site for some layout ideas - see our twitter feed which adds recent links and stuff to our sidebar (on single article view)
http://www.theChristianAlert.org
Edgar.