Extension talk:Widgets
Contents
![]() First page |
![]() Previous page |
![]() Next page |
![]() Last page |
In one of my 1.16.4 MWs the extension "Widgets" (0.9.2, Version 80102) does not work: the wiki page simply renders the source text: {{#widget:Google Gadget |url=http://www.google.com/coop/api/008224879786263662799/cse/dlukhlm8-0m/gadget |title=TEST |width=320 |height=76}}. I have checked so far
- the inclusion of the extension "Widgets" (o.k.)
- the listing of "widgets" as a parser function on Special:Version (o.k.)
- the permissions of the folder compiled_templates (writable for the server)
- the existence of the namespace "Widget" and the page "Widget:Google Gadget" with content (o.k.)
The apache error-log has an entry: "" is not a valid magic thingie for "widget"
Does anybody have an idea why the parser tag is not recognized and how the problem can be solved?
Thank you very much
I'm trying to create a widget for ReseacherId. The problem there is that the HTML code of a ResearcherId Badge requires a unique element ID at two places in the code (in this case the id is badgeCont983337):
<span id='badgeCont983337' style='width:126px'> <script src='http://labs.researcherid.com/mashlets?el=badgeCont983337&mashlet=badge&showTitle=false&className=a&rid=A-7713-2008'> </script> </span>
I have tried to generate this id and store it in a Smarty template to be able to reuse it, but to no avail. What I tried looks like the following. I have also tried various variants.
<!--{assign var="elid" value=$id{counter}}-->
<span id=<!--{$elid|escape:'html'}--> style='width:126px'>
<script src="http://labs.researcherid.com/mashlets?el=<!--{$elid|escape:'html'}-->&mashlet=badge&showTitle=false&className=a&rid=<!--{$id|escape:'html'}-->">
</script>
</span>
The problem seems to be that the function counter is not called when the template elid is created. How can I do this? What am I doing wrong?
i just installed Widget extension using SemanticBundle and installed Youtube widget. But it dont show up videos instead it give error like this.
Warning: Smarty error: unable to read resource: "wiki:YouTube" in /home2/uetblogs/public_html/wiki/extensions/Widgets/smarty/Smarty.class.php on line 1095
How can i get it worked?? :(
[edit] Not updatable
After changing a widget nothing changes on the pages that call it. It is stuck in some cache. Purging doesn't help, neither does manually cleaning compiled_templates folder.
[edit] <noinclude> section is included anyway
Subj.
UPD: the template seems to compile correctly. Can it get stuck in the message cache?
[edit] Resolved
Since the extension generates PHP code, any PHP cache like APC should be purged before the changes take effect. If you add code that does it (for common PHP cache engines) on widget page purge, it will be helpful.
For some days Mediwikiwidgets.org is not reachable. Will the website come up again? Singlespeedfahrer 15:23, 31 August 2011 (UTC)
Hi, when I use the Google Presentation widget I only get a white plane in the place where the presentation should be. It doesn't say that the document doesn't exist (which it does when I change the docid) so apparently that is not the problem. But what is, I don't know!
I have the same problem. It appears to be something wrong with new presentations. Old presentations with short ids can be displayed.
Here is a hack: One can disable new presentation editor and make older format presentations as described here: http://support.google.com/docs/bin/answer.py?hl=en&answer=1685857
Hello:
I've installed the Widget extension (version 0.9.2) on MediaWiki v1.15.1.
When is the Widget namespace created?
Shouldn't I be able to see it right after unpacking the extension in the extensions directory and adding the include statement in LocalSettings.php?
I've checked at Special:AllPages and I do not see the new namespace.
Thank you for any advice you can give me.
Patricia Barden 19:27, 3 February 2012 (UTC)
Yes, you should be seeing Widget namespace on Special:AllPages right after adding it to LocalSettings.php
Do you see any error messages in error log?
Thank you for your response.
I have error reporting turned on and there are no errors showing up. Additionally, I checked the Apache error log and did not see anything there either.
So, I decided to set up a clean install of MW 1.15.1 and try out the Widgets extension there. The namespace showed up without any problem.
So, I had to figure out what was causing the namespace not to show up on the production site.
There appears to be a conflict with a custom namespace that was set up for portal pages. If I comment out the following lines in LocalSettings.php, then the Widget namespace appears:
$wgExtraNamespaces =
array(100 => "Portal",
101 => "Portal_Talk"
);
$wgNamespacesWithSubpages[100] = true;
Do you have any idea how to fix this? We definitely do not want to stop using portal pages on our wiki.
Thank you for any help you can give me with this.
Patricia Barden 20:06, 6 February 2012 (UTC)
Hmm, I have a similar setup on my wiki with a working widgets extension. I guess you have to use the ns constant instead of the ns number. Did you define your namespaces?
# Define namespaces
define("NS_PORTAL", 100);
define("NS_PORTAL_TALK", 101);
# Name namespaces
$wgExtraNamespaces[NS_PORTAL] = "Portal";
$wgExtraNamespaces[NS_PORTAL_TALK] = "Portal_Talk";
# Subpages for namespaces
$wgNamespacesWithSubpages[NS_PORTAL] = true;
Cheers
this information was reverted, it includes a gallery widget example [1] Adamtheclown 14:06, 26 July 2011 (UTC)
Here is more information on the gallery widget also here.
As soon as I enable the extension for the first time, I get the above error. I'm running Mediawiki 1.16.5 on a Windows 2008 server. I'm guessing it's a permissions issue, but I'm not sure which folder and which user to grant permissions to.
I'm not sure what CDB is - are you sure it's Widgets extension that throws the errors?
I only get the error when I enable the widgets in my LocalSettings.php. Here is the full error which will hopefully shed some light.
Hi, perhaps setting the rights of folder /cache to 777 (= writable) will solve this problem. Cheers
That worked! Thanks... I was focusing on the compiled_templates folder. I'm running Mediawiki on a Windows 2008 R2 Server so I just had to make the folder writable using user permissions.
Hi, I installed the Widgets extension and then created the page Widget:YouTube and put {{#widget:YouTube|id=NAal5r_qEQY}} on this page, but nothing shows up on the page. I have been trying to trouble shoot the problem for a while, but haven't been able to seem to figure out the problem yet.
I'm using MW 1.17 and have set the permissions for compiled_templates to 666 . Any advice on what steps I can take would be much appreciated.
Did you check log files? do they show any errors?
Thanks for getting back to me. I checked the log files and they didn't show any errors. I'm not sure if it really matters, but when I remove the # from {{#widget:....}} the code from Widget:YouTube appears on the page. The code is
<object width="" height=""><param name="movie" value="http://www.youtube.com/v/"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/" type="application/x-shockwave-flash" wmode="transparent" width="" height=""></embed></object>
When I leave the # in the code nothing shows up on the page. It is pretty weird. Have any other ideas?
Thanks again for both of your help. I'm very eager to get this working, so I poked around the PHP code a little bit. I was wondering if you might be able to help me interpret what I found.
In wiki_get_template, the line
$widgetCode = $widgetArticle->getContent();
is returning the content of the YouTube widget. This seems like a good sign in that Smarty is able to access the wiki template.
However, in renderWidget, when I inserted the code,
echo "<-- renderWidget afteroutput=$output-->";
right after
$output = 'ENCODED_CONTENT '.base64_encode($output).' END_ENCODED_CONTENT';,
the resulting HTML included <-- renderWidget afteroutput=ENCODED_CONTENT END_ENCODED_CONTENT-->
In other words, the content of the widget seems to get completely lost by the end of renderWidget. Somehow, it looks like fetch() isn't working quite right.
You can view this for yourself at the following page: http://tmswiki.medialayer.net/w/index.php?title=Scratch_pad&action=purge Because the wiki is being used and I didn't want to leave any detritus around, I added a '!' right after the '<' in the following line
echo "<-- renderWidget afteroutput=$output-->";
Doing so turned the output into an HTML comment, so it can only be seen if you look at the source.
Thanks for your help. I think that this must have been user error. I uninstalled and very carefully reinstalled and everything is working perfectly.
I can create pages in the Widget: namespace, and the Widgets extension is installed, but whenever I try to save or preview a page with the code to include a widget in, I get the following error message:
Fatal error: Smarty error: the $compile_dir '/var/www/theopenglobe.org/w/extensions/Widgets/compiled_templates/' does not exist, or is not a directory. in /etc/wikiglobal/mw/extensions/Widgets/smarty/Smarty.class.php on line 1093
What is causing this, and how can it be fixed?
Extension:Widgets requires write permission for a subfolder of its code folder (Widgets/compiled_templates). Does this work if many wikis share the same code base, i.e. all these wikis would write into the same folder? Are the cache-file-names created wiki specific? Widgets is the first extension I encounter (not suggesting that I know all...) that attempts to write into the code area rather than to the standard $wgCacheDirectory. G.Hagedorn 10:03, 28 August 2011 (UTC)
Hi, I just installed Widgets and also got the following smarty error: Warning: Smarty error: unable to read resource: "wiki:Google Maps" in /home/rtseeker/public_html/en/extensions/Widgets/smarty/Smarty.class.php on line 1095
The wiki page is: http://www.omneswiki.com/en/index.php?title=Restaurants I saw Sergey's reply to "Klurie" about creating a new Widget:Google Maps page. It is impossible to create new page Widget:Google Maps or any page starting with "Widget:". So I tried to delete the Widget extension, and then I was able to create Widget:Google Maps page and copied the source code. Then I added Widget extension back to MW, but it gives me the same result, and the Widget page I created simply disappeared.
Thank you very much for your help!
Lei
You should not create pages in Widget namespace before you install the extension - they basically show up in main namespace with name starting with "Widget: ".
Disable the extension, delete the page, then enable the extension and re-create the page.
Keep an eye for the exact name of the widget - it must match the name you enter in parser function call on the page.
Hi, as far as I can see there is not thumbshot service available. It would be cool to have one though. Are there any plans? Cheers
Not sure what you mean by thin shot service. Can you elaborate?
Hi Sergey, I was thinking of something like the integration of thumbshots provided by services like e. g. http://www.thumbshots.com/, http://www.thumbalizr.com/. Hopefully this is possible. Cheers
I'm still not sure I understand. Are you looking for a widget that will include thumbnail of the URL using those services?
Yes, the widget should display the thumbshot of the entered URL, e. g. entering http://www.mediawiki.org/Extension_talk:Widgets would display a thumbshot of this talk page. Cheers
I understand that templates can use parser functions, and that templates can use widgets, but can widgets can use parser functions?
What do you mean by "use parser functions" - within the #widget call, or within the widget definition itself? You can use them in the former, but not in the latter.
I think the source of my confusion was trying to learn widgets and templates at the same time and using the two interchangeably.
I've now figured out that Widgets are most effective when used within Templates.
Widgets themselves can have if/else statements coded using Smarty.
It makes sense to combine them with Templates if you want to insert a site-wide API key or display the widget with predefined parameters, but allow users enter one of them (e.g. YouTube video ID or Twitter search query).
Glad it works for you now - enjoy!
Sergey
Would it be possible to include a list of the widgets used on a page (similar to how MW lists "Templates used on this page") at the bottom of the edit form? I tried looking through EditPage.php and here to see if there were any hooks in the right place to do this, but none of them seemed promising.
Having this list would make it easier for users to find the widget's documentation. (Example: User sees another user's page with spiffy stuff on it, thinks "How did they do that?" --> edit page to see code --> see widget list at bottom --> click link to widget page --> voilà!)
I'm fairly new to MediaWiki and trying to install Widgets. I'm receiving the following error when trying to use one of the widgets (I tried google spreadsheet, and youtube): Warning: Smarty error: unable to read resource: "wiki:YouTube" in /var/www/html/wiki/extensions/Widgets/smarty/Smarty.class.php on line 1095 I followed the installation instructions and went through the troubleshooting errors (I'm sure I'm spelling everything correctly, because I just copied from the webpages, and I've also purged the page to make sure it's reloading from the source)
Do you have any suggestions for what might be wrong? I'm not sure what other details would be useful here, but please let me know. Your help is appreciated.
Thanks! Klurie
Forgive me I'm new to Media Wiki's but how dangerous is it to give read, write access to all potential users?
Start telnet with port22 find / -name 'compiled_templates' [cr] [result] /share/MD0_DATA/Qweb/mediawiki-1.15.1/extensions/Widgets/compiled_templates chmod a+rw /share/MD0_DATA/Qweb/mediawiki-1.15.1/extensions/Widgets/compiled_templates
I was just wondering if there is any more secure way of doing this so that a would be hacker couldn't mess this up, or is there something I'm missing that makes this more secure then I think it is?
thanks for you time
I'm not the extension author, so I'm basing this on other knowledge I have on how webservers work, etc.
From what I can tell, the reason to make this writable by everyone is because the webserver runs as a (presumably) different user than you who owns the files. Since the webserver (PHP specifically) needs to be able to write to that directory, you need to give that user write permissions. The easiest way to do this without assuming people have strong working knowledge of linux permissions is to simply make it writable by everyone. Is this the most secure way to do so? Absolutely not, but it certainly is the easiest to follow. Alternatives include running PHP as a CGI module (via fastcgi or similar) in apache so that the PHP gets executed as the user who owns the file, and thus you would not need to make it world-writable. Another alternative is to chown/chgrp (dunno if chgrp is a command or not, but it sounds like it should be) to the user php/apache is running as (probably www-data or nobody) so that you can set user/group permissions instead of world permissions.
There is no way around it until Widgets are rewritten using new Smarty which does not require the files on the drive to be created.
Hey guys! I applied some widgets to my mediawiki,and i'm trying to use some resources made by me with them For example,i'm using the Voki widget(http://www.mediawikiwidgets.org/Voki).The code goes like this
{{#widget:Voki|id=74c74db2e8026a0fc7b161cc29f5742d%26sc=2370055}}
I've made me on Voki,avaliable here http://www.voki.com/pickup.php?scid=3638109&height=267&width=200 So,where do i get that ID,to use it with my widget? I'm having the same problem wit the Google Docs Widget too =/ Can anyone help me,please? If you want to contact me,please send an email to tatsuya.naru@gmail.com
Hi tatsuya.naru, I would expect that voki.com provides this id. I advise you to inquire there for this id. Probably it is indicated somewhere in your personal account on their page. Cheers --[[kgh]] 16:24, 30 March 2011 (UTC) PS I think Voki is cool. I was just looking for something like that. Thank you for making me aware of it.
![]() First page |
![]() Previous page |
![]() Next page |
![]() Last page |



