Jump to content

Soma

Moderators
  • Posts

    6,798
  • Joined

  • Last visited

  • Days Won

    158

Everything posted by Soma

  1. A example code how to set a templatefile on runtime $t = new TemplateFile($config->paths->templates . "./another.php"); // send vars explicitly possible // $t->set( "somevar", $somevar ); // $t->set( 'input', $input); echo $t->render(); However I think you might like the template option i the advanced setting to use another template instead. Also your example works using the render method of a page. Have a template video.php that includes teaser.php. Then use your example code as is.
  2. The problem lays in the if( $newsChildPage == $newsChildrenArray->first() ) { Comparing object shoudl be done using "===" Not sure why the error, but with "===" it works. However I cleaned up a little your code, using heredoc (<<<_END) which can be handy to generate output code so the indentation stays. foreach( $newsChildrenArray as $newsChildPage ) { $newsImg = ''; //Test for an image on the current page if( count($newsChildPage->images) ) { //If this is the first article, make a larger image if( $newsChildPage === $newsChildrenArray->first() ) { $newsImg = $newsChildPage->images->first()->size(157,151); } else { $newsImg = $newsChildPage->images->first()->size(77,71); } } $class = ''; $imgstr = ''; if( $newsChildPage === $newsChildrenArray->last() ) $class = ' class="last"'; if( $newsImg ) { $imgstr = "<img src='{$newsImg->url}' alt='$newsImg->description'/>"; } $out = <<<_END <a href="{$newsChildPage->url}"> <li$class>$imgstr <p> <span class="preview-title">{$newsChildPage->title}</span> • <span class="preview-date">{$newsChildPage->date}</span><br /> {$newsChildPage->summary} <a href="{$newsChildPage->url}" class="read-more">Read More...</a> </p> </li> </a> _END; echo $out; } Also changed some things to avoid further problems. Using ->eq(0) for example to check if there's an image is wrong. It won't work if there no image. Use count(); Also the check if($newsImg) will fail if there's no image as the variable won't exists. So you need to set it before.
  3. Something I noticed when using this module. When I use the $page->render() method for the proxy template. I have a auto hook on Page::render that add in some script before the body end with php string replace. For some reason it's getting executed 2 times resulting in duplicated code. I'd guess the page rendered with ->render() in a template causes the system to render it twice? Edit: This is used in the proxy template $page = $modules->get('LanguageLocalizedURL')->parseUrl(); echo $page->render(); And using this hook to str_replace html $this->addHookAfter('Page::render', $this, 'addScripts'); So I have to add this to check if already there // if already there (in case of using $page->render()) if(strpos($event->return,$script) !== false) return;
  4. Ok I just pushed an update. You can now disable transitions. I will at some point hide the additional options in a hidden settings layer. I will still have to see what I'll do with additional stuff. I also see adding some that's left off in the same sheet and give them a color code like advanced. Adding additional sheet that can be switched would aslo be nice, but not as trivial as it seems.
  5. I'm kinda with Ryan. I really like the animation and it has the right speed. It depends a little on the browser as it's done with css transitions. Making it even faster will not help but make choppy (depends on how many elements are animated). But I agree it would be nice to turn it off if one likes. So it is very easy to add another option to disable it. Will push an update later.
  6. One small correction: Cufon Canvas,VML depending on the browser from which it generates a base64 encoded png image for each word. In Firefox right click will show it's an image. Enter code in address bar and you'll see the image: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFwAAAAYCAYAAAB3JpoiAAAC8UlEQVRoge3YTYhWVRwG8J/mR5rCjJMiuREH+xBxmMEQwTAxKwulMDPUhW2EsI9dujIQVAx3GlIILcJFC1uFRbsChZyFCxPFolBqUyqlZCmlLv5n6PrOez/ed+Z1kO4D/8U55znP/Z/nnns+LjVq1KhRo0aNEaELy7ESsyvwp+NJPI1FmNzQvhCLSzQWoS9TfhhL0FPQZ1biPJRyXlIxpmf0y3gdxWR8gBu4neIW3svhr8DnuJnh38Z1HMnwBvF7ybO/w7lMeUvS2lTQ543EWYwXGnIoimUZ/by4jjklOY8Yh/BnGkgv5uE1bGzgjcPBlNgF7MIzGMCL2I2jGf69MHwmVjfEJVxsUt8tzGysX429STNvko0aJuBvHKjAfV8kdRhTK/DvheHN8AvOVshvCA/gNH7Cgy30awuTxPLxSQlvIPE+EzO9Cu4Xw99Mei+10GdE+Ar/YEMBZ2gp6W1B934wvAdX8GVF/qhgDk6IQXyBZw2fxd/i+xZ1B8Xe8HJBXDS2hh8Sm/9jFfmjhvF4BSfFYE6hP9N+Dsdb1BxU7fQwVob3iS97XwVuR7EO18RyMCvVHccPLeoM4irmFsR5Y2f414k7rQK349goBvV2Ku9P5Udb0GhnDd+cnrOloM9bidOf017F8A1Jo/HoO2boEQntT+XHxed3TByjqqAdw59Kzy36zIc28Edy2ssMnyr2jm9KcusI5hl+JYdVYlBbM3XvprpPMaOCdjuGT8Sv4vLS7MbXiz9wpkCzzPBdYvL0FXA6hrXibe8Rm+Ya7BRHpTOY0sDfKZK9JGbaenHVXydumh9luO0Yzn/Lys94B0vFtXw7fsO/4naYhyLD5+IvcdHZlhMDJTmPCN34MCUxdGq4Ko5LXTl9+vExLrv7tHEer2d47RoOr+JHw080ZxWbTbHhR5poNsaOEv1RwQQ8ITbFiS30mymWpWZ/2LrF37kidMtfnsZhAZ7Hc5hfMaeeAs0ukXNRVPltUaNGjRo1/ie4A4uSB/OfVG5sAAAAAElFTkSuQmCC When you scale a website with cufon for text, you'll see the pixels.
  7. "The emulator is super simple to install and lets you do serious mobile development from your desktop." So far none of the emulated devices shows/works the same as with the real device. Some more or less. I wouldn't rely on emulators at all for serious developement.
  8. Soma

    DRY URLs

    Also consider to write a script that checks all textfields (tinymce textareas) where link could be inserted, to check links and or modify them as needed in one click. Either use simple_html_dom.php class or using some regex. Other thing I would consider is adding such links using a tag {url:somekeytext} and replace them with a script before the output. This could also be maintained using a "page" with all the links in a repeater with tag and url that will be used for the replacements. Some module hook could maybe even add them to tinymce or its field description for reference.
  9. Have you deleted cache and maybe cookies? Looks and works fine here. What OS?
  10. Thanks for the feedback. Yes I know, but I don't know a way to turn it off because it's doing what it's supposed to Well it doesn't happen often, so I can live with it. One way to get around it would be to make the description hover. I tried something but there's some issues with indexes and would complicate things or would have to add another tooltip like functionality. But got so used to the toggle slide and like it so far.
  11. I've been working for some time on an updated version to functionality of the cheatsheet and have commited it now. All code and functionality, no content changes. removed table layout and added the excellent Masonry/Istope js for block layout and filtering added setting for column count so you can change it to your best fit in the toolbar improved live search, especially in Firefox (which wasn't really working before) now sections not containing any filter results will be hidden (not get in the way anymore) These changes also will help adding more content to the sheet. Preparing to launch the rocket! Enjoy.
  12. Nope Peteee, it wasn't working when using single value slider, a missing semicolon will break javascript if it's not the last line
  13. Soma

    DRY URLs

    Don't know if you know this module. Maybe something like this would help?
  14. Thanks tiagoroldao, nice catch! Seems as not much are using it yet, otherwise someone would have run into this. Though it worked with range enabled. Well, you can always open new issue on github repo. It's public. https://github.com/somatonic/RangeSlider/issues It's fixed and commited. I also improved the module install. You only need to install the FieldtypeRangeSlider and the InputfieldRangeSlider will be installed and deinstalled automaticly. If you already have it installed it's safe to just replace with the new files.
  15. slkwrm, yes kinda, but won't work out of context and only if there's a page selected already.
  16. Not sure I understand Might be like this? $res = $pages->find("template=topic, topic=$page->children, sort=-created, limit=10");
  17. There's no simpler way. However I would write: $children = $pages->get($fields->select_architect->parent_id)->children;
  18. Thanks guys. Originally I had some special stuff in there and things like pager etc. , but because Ryan had some gripes with it, I removed it. So I'm interested what Ryan thinks too.
  19. Thanks for the post Martijn. Glad to hear it serves its purposes. One reason it's not in there, is because language support was still in development and moreover it's not core, it's a third-party module and need to be installed (although it's in the distribution). There's couple things not in the cheatsheet that are not permanent modules i.e. like the comments, pager etc. I'm not sure if those distributed modules should be added somehow or make a separate sheet. What you guys think?
  20. However, I'm not sure you really want to use that fieldtype as it is limited to special types of modules based on the parent class. May I suggest using a regular page field with ASM select inputfield or alike, and create pages for each module you want to be able to select. Then use the title on those pages to load the module in the frontend. So you could even have multiple modules and sort them the way you want them to load. Depends on what you're up to. // when multiple select foreach($pages->selected_modules as $mod) { $module = $modules->get($mod->title); $module->render(); } //or just a single select $module = $modules->get($page->selected_module->title); $module->render();
  21. The module reference is shown if you enable advanced mode in the config.php. Then you can select when creating a new field.
  22. The module has no url param functions so I'm a little surprized it changes language, so this may from PW itself or you did something to get the url param? However you can simply do something like this: Somewhere in the template I have this before the language switch $lang = $user->language; $langname = $lang->name == 'default' ? 'en' : $lang->name; Then the language switch links // get users current language $lang_temp = $user->language; // set language to default $user->language = $languages->get("default"); $st = $langname == 'en' ? " class='on'" : ''; echo $page->language_published->has( $pages->get("/en/") ) ? "<a$st href='{$page->url}'>EN</a>" : ''; // set language to german $user->language = $languages->get("de"); $st = $langname == 'de' ? " class='on'" : ''; echo $page->language_published->has( $pages->get("/de/") ) ? "<a$st href='{$page->url}'>DE</a>" : ''; // set users language back $user->language = $lang_temp; Like this, the "$page->url" will return the language url already, if the users language is switched while creating the links for each language. So no need for urls params, cookies, sessions or anything. The page field "language_published" references the proxy language pages, so we can easily check if the language is really published (checked), which means it holds the proxy page. Since it's a page reference field we can simply use $page->language_published->has() method. Edit: added missing script needed before.
  23. Looks really great! Seems like a well created tool to save time. However regarding different sizes, is it possible to automate creation of various sizes, and how will it behave with filters when scaling? Are you using vectors for this because pixel icons will not work well? I know it says something that it can do duplicates but not much more infos on this. One note: make the video playlist off, after watching the video it shows slash games videos. You can turn it of or add your own playlist with params. Edit: BTW: I just bought it!
  24. You can't put php variables inside single quote string, only double quotes are getting parsed. No need to use remove(), the selector is the easiest way.
×
×
  • Create New...