Jump to content

rizsti

Members
  • Posts

    12
  • Joined

  • Last visited

Everything posted by rizsti

  1. I was wondering if anyone could give me some input on this topic in regards to ProFields Textareas. I tried the method above ( $page->fields->prod_texts_data->$key->label inside the foreach loop below) but it threw an error. I've found a solution to drawing out the label of the defined textareas, but I'm not sure if it's the appropriate way to do it, so I figured I would ask. <?php $fieldType = $modules->get('FieldtypeTextareas'); foreach ($page->prod_texts_data as $key => $value){ echo $fieldType->getLabel($fields->get('prod_texts_data'), $key); } ?> Or is there an easier way to do this?
  2. I'm having trouble with removing the fit to markers functionality when using multiple markers. I've read through some of the previous post on the subject and Ryan seemed to indicate that I needed to use 'new PageArray()'? I tried what BFD Calendar did, and this resulted in the proper zooming and lat and long, but no markers. I also tried: <?php $markers = new PageArray(); foreach ($page->children() as $c) { $markers->add($c); } echo $map->render($markers, 'loc_mapmarker_map', array( 'fitToMarkers' => 'false', 'id' => 'newmap', 'type' => 'ROADMAP', 'icon' => '/site/templates/styles/images/pin.png', 'height' => '583', 'lat' => '49.8602016', 'lng' => '-97.1510875', 'zoom' => '10', )); ?> Which resulted in it fitting to the markers again. Any help would be appreciated. Thanks, Riz
  3. Hey guys, I'm building a site that has some rather long urls going on which is going to be a problem because there are going to be some social media buttons on the website, specifically a twitter share button. This module is looking to be a good solution but I had been hoping to generate the short urls rather than depending on the client to create them. I've created a module that hooks into page save and creates a new short url if an existing on for that page is not found. My issue is that it creates too many short urls. I've tried hooking into different aspects of the page save to see if it makes a difference (which it does) so I'm suspecting that I may not fully understand hooking (as I haven't used it too many times). $this->pages->addHookAfter('save', $this, 'createLink'); creates 2278 links $this->pages->addHookAfter('added', $this, 'createLink'); creates 2248 links $this->pages->addHookAfter('saved', $this, 'createLink'); creates 1124 links Except for the first link, which is correct, each link refers to the previous link. Here's what I have: /** * Initialize hooks */ public function init() { $this->pages->addHookAfter('save', $this, 'createLink'); } /** * createLink hooks into the pages->save method and creates a new short url if an existing one is not found * */ public function createLink($event) { $page = $event->arguments[0]; $full = $page->url; $l = wire()->pages->get("template=LinkShortener,full_link=$full"); if($l instanceof NullPage) LinkShortener::addNewLink( $full, $page->id ); } Any help you can offer would be appreciated. Thanks! Riz Edit: I've discovered my super rookie mistake. I didn't take into consideration that when the short url was created it was triggering a page save which was what was creating an infinite loop which ended up timing out when it got somewhere in the thousands. Changed it to: public function createLink($event) { $page = $event->arguments[0]; $full = $page->url; if ($page->template != "LinkShortener"){ $l = wire()->pages->get("template=LinkShortener,full_link=$full"); if($l instanceof NullPage) LinkShortener::addNewLink( $full, null ); } } And it works great.
  4. Hi and thanks for this nice module I'm having a bit of a problem with the thumbnail component of the module. Sometimes when I create a thumbnail the resize creates extra noise in the image. Sometimes deleting the pdf from the page and re-uploading it removes the noise, so it doesn't seem to be an issue with the file itself. For now I'm working around it by commenting out the line in the module that resizes the image ($imagick->scaleImage($width, $height); from PagePDF.php) and using Image's size function. Any help would be appreciated. Thanks
  5. No, I don't need to add any core functionality and the button doesn't exist. I just want to create buttons with functions attached. Which hooks should I be looking into? This is sort of what I'm looking for (or a better way to do essentially this):
  6. I'm trying to create a module that will execute functions when a button is pressed. What would be the best way to implement this? The options I've considered are: Using a Process and creating a page in the admin section of the website; Or perhaps creating a module and having a button on the settings page; There are probably other ways to do this that I haven't considered. I'd be open to suggestions. Thanks for any help
  7. Thanks for your help. I agree wholeheartedly on not using Internet Explorer, however we try to keep support for our clients as old as IE8.
  8. Hi guys, I've been running into a problem with Internet Explorer 10 and below in the backend. Whenever I upload an image and then click on the image (when it usually pops up the image in a fancybox) it just darkens the screen but the image doesn't appear. I'm wondering if anyone has encountered this before and/or has a solution for it. The attached screenshot is of IE 8. Thanks for any help. Riz
  9. I just wanted to bring to your attention that having an apostrophe in the title creates an error. Whenever I tried to create a map with locations where the title had an apostrophe in it (such as God's River, Manitoba) I would get an "Uncaught SyntaxError: Unexpected identifier" and the map wouldn't display. I changed line 191 in MarkupGoogleMap.module from: $out .= "$id.addMarker($marker->lat, $marker->lng, '$url', '$title', ''); "; to: $out .= "$id.addMarker($marker->lat, $marker->lng, '$url', \"$title\", ''); "; and that seems to have fixed it.
  10. Oh. That definitely makes sense. Thanks for your help.
  11. Hey guys, I'm having a problem with rendering an rss feed of the current pages children. It simply doesn't render any items when I use $page->children. However when I use the provided sample of $items = $pages->find('sort=-modified, limit=10'); it displays them all fine. I've checked and my selector does return results so I'm not sure what's going on. My code: <?php $rss_feed_segment = 'rss'; if (strtolower($input->urlSegment1) == $rss_feed_segment ): $modules->get('Spex')->setBaseLayout('_rss'); // retrieve the RSS module $rss = $modules->get("MarkupRSS"); // configure the feed. see the actual module file for more optional config options. $rss->title = "Latest updates"; $rss->description = "The most recent pages updated on my site"; // find the pages you want to appear in the feed. $news_items = $page->children; // send the output of the RSS feed, and you are done $rss->render($news_items); endif; The output: <?xml version='1.0' encoding='utf-8' ?> <rss version='2.0'> <channel> <title>Latest updates</title> <link>http://courts.dev/court/news/</link> <description>The most recent pages updated on my site</description> <pubDate>Mon, 21 Oct 2013 12:13:14 -0400</pubDate> <ttl>60</ttl> </channel> </rss> I've never worked with with RSS feeds before so I may just be missing something simple. Thanks for any help!
×
×
  • Create New...