-
Posts
319 -
Joined
-
Last visited
-
Days Won
1
Everything posted by formmailer
-
Just added a translation for: /wire/modules/LanguageSupport/LanguageSupport.module (download via Github) //Jasper
-
Just added a translation for: /wire/modules/LanguageSupport/LanguageSupport.module //Jasper
- 1 reply
-
- 1
-
Thanks for the code Soma, but after reading the previous I'll stick to having a seperate (CDN hosted) jquery on the frontend. /Jasåer
-
I actually do. With a fallback, just in case the CDN is unavailable (I believe Google's CDN is blocked in some countries, although I don't expect many visitors from these countries...) <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript"> if (typeof jQuery == 'undefined') {document.write(unescape("%3Cscript src='http%3A%2F%2Fmydomain.info%2Fjs%2Fjquery.min.1.7.1.js' type='text/javascript'%3E%3C/script%3E"));} </script> Thanks! That explains a lot. I assumed that these modules could be used in the site's front-end as well. /Jasper
-
Hi, I don't really understand how to use the jquery modules. Until now I just loaded jquery and fancybox directly from my template, but this might not be the best way to go (although it gives the possibility to combine and compress all .js & .ccs files to improve loading times). What should I do to load jquerycore and fancybox using the modules? Thanks in advance! /Jasper
-
Sorry about that, I checked and used the same code on my site, but with one small difference: I used a pageID as the selector and that works of course, since that's a string value /Jasper PS: Ryan's last example missed a bracket. Not a big thing, but for the sake of completeness 8) :
-
You could do something like foreach($children as $child) { if($child->numChildren && $child->parent!="/news/") { // Your code to subpages list your pages here } } Note: didn't test the code, just written in the browser Hope this helps! //Jasper
-
Great Ryan. A smart solution!
-
Just a little reminder for those who created modules: because of the forum change, the links to the "module info topics" do not work anymore. It might be a good idea to update the URL's, both in the Module info part of the module itself and in this list. /Jasper
-
The attachments are there, under Nikola's first post in this thread. /Jasper
-
Thanks Pete, I missed the mobile version since it didn't load by default on my phone. /Jasper
-
Would it be possible to have a mobile version of the forums? I love to read the forums using my smartphone, but replying isn't always easy.
-
It looks great guys! I think I am going to spend more time here. /Jasper
-
It would probably be something like this <?php // add a hook after the $pages->save, to issue a notice every time a page is saved $this->pages->addHookAfter('save', $this, 'example1'); But note that this will hook on every page save, even on page updates or when comments are added. /Jasper
-
Hi Ryan, Pretty cool that you used the Dutch translation in the movie. When looking at the movie, I started wondering how the languages work for guest users. Registered users can, of course, select there language in the profile, but guests can't do that. Can a guest look at the site in another language than the default? /Jasper
-
You also could use a Sitemap Index (<sitemapindex>) which allows you to have multiple sitemaps per site. This allows you to break your sitemap up into several smaller sitemaps. You could even have different cache times per branch, eg. 5 minutes for the news section and 1 day for the other pages. /Jasper
-
Extending the ImageField with a watermark option
formmailer replied to formmailer's topic in Module/Plugin Development
This could probably be solved by saving the image with another name, eg image-watermark.jpg and based on the image size it the page will render them either from the source image or there watermarked image. But I don't know how to do this yet. -
It is also recommended to add the following to your robots.txt file (create one if you don't have one): Sitemap: http://www.your-domain.com/sitemap.xml This allows search engines to find your sitemap.xml, even if you didn't submit it to that specific search engine. Regarding this module, until now I've always used a sitemap.xml template. When I created that one I used the regular sitemap page as an example. But I will certainly try this module sooner or later. /Jasper
-
Hi! I found the following code snippets on php.net and figured that it would be a nice add on to the ImageField. Example #1 Adding watermarks to images using alpha channels <?php // Load the stamp and the photo to apply the watermark to $stamp = imagecreatefrompng('stamp.png'); $im = imagecreatefromjpeg('photo.jpeg'); // Set the margins for the stamp and get the height/width of the stamp image $marge_right = 10; $marge_bottom = 10; $sx = imagesx($stamp); $sy = imagesy($stamp); // Copy the stamp image onto our photo using the margin offsets and the photo // width to calculate positioning of the stamp. imagecopy($im, $stamp, imagesx($im) - $sx - $marge_right, imagesy($im) - $sy - $marge_bottom, 0, 0, imagesx($stamp), imagesy($stamp)); // Output and free memory header('Content-type: image/png'); imagepng($im); imagedestroy($im); Example #1 Using imagecopymerge() to create a translucent watermark <?php // Load the stamp and the photo to apply the watermark to $im = imagecreatefromjpeg('photo.jpeg'); // First we create our stamp image manually from GD $stamp = imagecreatetruecolor(100, 70); imagefilledrectangle($stamp, 0, 0, 99, 69, 0x0000FF); imagefilledrectangle($stamp, 9, 9, 90, 60, 0xFFFFFF); $im = imagecreatefromjpeg('photo.jpeg'); imagestring($stamp, 5, 20, 20, 'libGD', 0x0000FF); imagestring($stamp, 3, 20, 40, '(c) 2007-9', 0x0000FF); // Set the margins for the stamp and get the height/width of the stamp image $marge_right = 10; $marge_bottom = 10; $sx = imagesx($stamp); $sy = imagesy($stamp); // Merge the stamp onto our photo with an opacity (transparency) of 50% imagecopymerge($im, $stamp, imagesx($im) - $sx - $marge_right, imagesy($im) - $sy - $marge_bottom, 0, 0, imagesx($stamp), imagesy($stamp), 50); // Save the image to file and free memory imagepng($im, 'photo_stamp.png'); imagedestroy($im); The only problem is that I don't know how to build a module that extends the image field. My goal is to have an option (probably a checkbox) for every image in the image field. Checking the checkbox would watermark the image. Can someone provide me with some hints to get started? /Jasper
-
Ryan, Do you have time to help me with this or my idea above (if that's possible to do it like that). /Jasper
-
Thanks Ryan, replacing the colons work, both with the str_replace and the regexp.. I also submitted (via Github) a double encoding issue (I am good in finding these ) in this module. You might want to take a look at that one at the same time. My fault , the comments property is parsed. One that didn't get parsed was the Category, but that may be because it appears multiple times. (guess). The exact feed I am using is also in the Github issue, so you can test with it if you want/like. /Jasper
-
No, for example comments didn't get parsed as well. /Jasper
-
I want to display a RSS feed that contains items like below and it works well, except for the author field (dc:creator), which isn't parsed. Is there a way to parse this value as well? <item> <title>Taalkundigen Uppsala ontcijferen geheimschrift</title> <link>http://www.wereldwijzerzweden.net/2011/11/03/uppsala-geheimschrift-taalkundige-copiale/</link> <comments>http://www.wereldwijzerzweden.net/2011/11/03/uppsala-geheimschrift-taalkundige-copiale/#comments</comments> <pubDate>Thu, 03 Nov 2011 16:03:16 +0000</pubDate> <dc:creator>Marcel Burger</dc:creator> <category><![CDATA[Actueel]]></category> <category><![CDATA[berlijn]]></category> <category><![CDATA[Copiale]]></category> <category><![CDATA[geheimschrift]]></category> <category><![CDATA[universiteit]]></category> <category><![CDATA[uppsala]]></category> <guid isPermaLink="false">http://www.wereldwijzerzweden.net/?p=7227</guid> <description><![CDATA[<a href="http://www.wereldwijzerzweden.net/2011/11/03/uppsala-geheimschrift-taalkundige-copiale/"><img align="left" hspace="5" width="150" src="http://www.wereldwijzerzweden.net/images/copiale_280.jpg" class="alignleft wp-post-image tfe" alt="Deel uit vrijgegeven beeld van het Copialeschrift" title="copiale_280.jpg" /></a>3 november 2011 | Twee Zweedse taalkundigen en een Amerikaanse wetenschapper zijn erin geslaagd een 280 jaar oud geheimschrift uit Duitsland met voorheen onbegrijpelijke tekens te vertalen.]]></description> <wfw:commentRss>http://www.wereldwijzerzweden.net/2011/11/03/uppsala-geheimschrift-taalkundige-copiale/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> I outputted the $rss array with print_r(); and it doesn't contain the dc:creator field (some others seem to be missing as well, but I don't need these ) /Jasper
-
I got it working! Good idea! I just did this. The core function: <?php public function getCurrency($cur) { $xml = simplexml_load_file("http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml"); $xml->registerXPathNamespace("ecb", "http://www.ecb.int/vocabulary/2002-08-01/eurofxref"); $array = $xml->xpath("//ecb:Cube[@currency='".$cur."']/@rate"); $rate = (string) $array[0]['rate']; $time_array = $xml->xpath("//ecb:Cube/@time"); $time = (string) $time_array[0]['time']; return array ($time, $rate); } Below is the template part: <?php $tag = "{CUR=SEK}"; $cache = $modules->get("MarkupCache"); if(!$output = $cache->get("output",86400)) { $array = $modules->MarkupCurrencies->getCurrency('SEK'); $rate = round(100/$array[1],2); $time = strtotime($array[0]); $output = "100 Zweedse kroon (SEK) is ongeveer $rate Euro (EUR)<br /> <span class='small-text italic'>(laatst bijgewerkt op: ". date('d-m-Y',$time) .")</span>"; $cache->save($output); } $body = str_replace($tag, $output, $body); The cache part makes sure that the parsing only happens once every 24 hours to avoid high server load and reduce loading times. But the str_replace part is running on all pages using this general template. Would it be better to have a specific template for this page? /Jasper