Jump to content

porl

Members
  • Posts

    110
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by porl

  1. porl

    Twig

    I know, I know.... I really like the way the Twig templating engine works. I tried to hack up a module (messy, with hard coded paths etc. just to test) but I'm somewhat out of my depth. I tried to make a module that had a before-render hook with this: require_once '/path/to/lib/Twig/Autoloader.php'; Twig_Autoloader::register(); $loader = new Twig_Loader_Filesystem('/path/to/templates'); (with paths adjusted of course) and a property hook (Page::twig) that returns the twig object below $twig = new Twig_Environment($loader, array( 'cache' => '/path/to/compilation_cache', )); This is all taken from http://twig.sensiolabs.org/doc/api.html I started to get odd errors from within the Twig files themselves and got lost trying to debug. Has anyone succeeded in getting a module to load Twig? What I would like to do is have the .php files in the templates directory initialise variables etc required and then twig load (from a 'views' folder) the twig template associated with the PW template. I know this goes against the PW idea of using PHP as a templating engine in itself, but I would really love to be able to use Twig for an upcoming project and I know others have asked about similar functionalities with Twig and other templating engines. Perhaps someone more knowledgeable than myself can point me in the right direction to get such a monstrosity of crossbreeding working? Slightly off topic: I tried to do the right thing and use the $config->urls... variables, but kept getting errors loading the Twig php files (even though the errors showed the correct paths). This is why I just started to use things like the __DIR__ variables for first tests, but even then I was having troubles. Perhaps some sort of NameSpace conflict?
  2. The main reason I asked was due to the fact that adding a resized image with a link to the fullsize image just acts as a hardlink to it. i guess i could override this with jquery for javascript enabled users to load the image in a lightbox type thing instead.
  3. Is there any way for this to be integrated with the TinyMCE image chooser? In other words an option in the image choosing screen to choose a 'thumbnail' instead of the main image and have all the thumbnail features in the page?
  4. Not entirely sure, but when I first tested the image field etc in a repeater I expected the tinymce image button to display images from that by default. The second thing I expected was that the images added to these embedded image fields would be browsable from the image button's dialog. Not to say the current behaviour is 'wrong', just not what I expected. Perhaps making it easier to find images from repeater fields when browsing in the image window would be the primary thing, but the default behaviour to me should be to show images in the related area first and then perhaps an 'other images on this page' option in the dialog. Sorry I'm not wording this very well, my brain seems to have gone for a walk.
  5. Perhaps an "on created" hook would be useful here and for other cases?
  6. I guess I could work around it for now with a "page wide" images field at the end of the repeaters, but it would be nice to have some sort of separation between elements.
  7. porl

    page slots

    Thank you for the detailed response, Apeisa. I understand and agree with all the points you have raised. It is hard sometimes to get clients to see the value in such a structured approach but in the end I think it is worthwhile. I have enjoyed what I have found so far and even if I can't use it for this project I am sure I will use Processwire in others down the track.
  8. Hi guys Just a quick question. When adding an image to an image field inside a repeater, the image gets added to an invisible page (/processwire/repeaters/forfield......). I understand why this is done, but if there is another field (a text block in this case for an article 'body') in the same repeater element the 'insert image' button cannot find it (it defaults to listing images associated with the page rather than the repeater element). Is there an easy way to allow simple insertion of images into blocks within a repeater element? Thanks
  9. porl

    page slots

    Thanks for your quick response. I'll look into it further to see how it behaves (with my 'non-expert' goggles on)
  10. Hi all. I have had a brief look at Processwire, and I must say I am impressed. I am in the process of evaluating different options for a new site for my employer. Initially I was looking at such CMSs as Concrete5 or Apostrophe. All of the solutions I looked at were either limited or bugged in some way that I believed would become a major issue for the people who would be adding content to the site. I began to think I would have to try and implement it all myself in a framework such as Symfony. Thankfully I found this site before it was too late. My question is (and maybe it has been answered elsewhere) how difficult is it to implement something like the page "slots" that many other systems use? I don't want to give them just large WYSIWYG blocks, as I believe that is part of the problem with their current site (consistency for one). I love the slots idea (add a title block; add an image block etc) but I'm not sure if this is easy to do in Processwire I'm probably just missing something obvious, but I'm not sure how I would go about making templates that can accept user definable fields (as opposed to field contents). Is this something that Processwire does? I admit I've only had time to look briefly so it may already do this. I saw some mention of this functionality in the "repeatables" topic, is this what I should be looking at? I need something that a non-expert can easily work with as I won't be the primary content editor once the site is live. Thanks for taking the time to read this. I really hope I can use Processwire for this site (even though I just finished getting used to the Twig templating engine which I love). PS. I'm in my mobile so I'm not sure if I can edit the initial post to add this, but I forgot to say that in browsing the forum here I have found this to be easily one of the friendliest development communities I have seen. Nice work everyone.
×
×
  • Create New...