Jump to content

bernhard

Members
  • Posts

    6,062
  • Joined

  • Last visited

  • Days Won

    295

Everything posted by bernhard

  1. anyone? what about performance? should both systems be almost equal if they have same specs?
  2. hi benbyf, the images are tremendously huge!! the first for example is 2248x3000 @ 1.9MB it's so easy to fix this with PW: <img src="<?= $page->your_image->size(1000, 1000, array('cropping' => false))->url ?>" alt="..."> and it will keep its aspect ratio. keep in mind that on first load it will need lots of memory + cpu so there may be some timeouts, but when all the images are resized the following pageloads will be faster
  3. got it! as simple as that: function addClass($element, $class) { $pw = wire(); // current pw instance $classes = wire('classes'); $classes[$element][] = $class; $pw->wire('classes', $classes); } in the other files: // _init.php // set classes for parent container addClass('tm-main', 'tm-section'); // blog.php addClass('tm-main', 'tm-blog'); // _main.php <section id="tm-main" class="<?= getClasses('tm-main') ?>"> <?= $content ?> </section> see apigen docs: http://kongondo.github.io/ProcessWireAPIGen/devns/source-class-ProcessWire.Wire.html#1027-1037 thank you szabez! also thank you horst for jumping in
  4. thank you szabesz, that makes sense to me. so would it be possible to set a property (right?) of the wire object inside a function in _func.php? function setPropertyOfWire($key, $val) { $this->wire($key, $val); } would not work, because $this is the wrong scope. OOP is still quite new to me
  5. hosteurope: 4 cores, 8GB ram, 250GB ssd -> 30€ / month digitalocean: 4 cores, 8GB ram, 80GB ssd -> 80$ ~ 70€ / month thats quite a difference - more than twice as much! i've read about many happy digitalocean customers here in the forums but i'm also happy with my vserver until now whats the advantages of using cloud hosting compared to a vserver? is it only the fact that you can scale your server up and down easily on the cloud whereas you have to migrate the whole server when using a vserver? thanks for your advices
  6. ok, finally i got (almost) what i wanted: // _init.php // set classes for parent container $classes = array(); $classes['tm-main'][] = 'tm-section'; $this->wire('classes', $classes); // blog.php $classes = $this->wire('classes'); $classes['tm-main'][] = 'tm-blog'; $this->wire('classes', $classes); // _main.php <section id="tm-main" class="<?= getClasses('tm-main') ?>"> <?= $content ?> </section> // _func.php /** * render class string for given div * * @param string key of element * @return string class string * */ function getClasses($element) { $classes = wire('classes'); return implode(" ", $classes[$element]); } using PW 3.0.12 it did not work with the example of tpr above using wire(x, y) without $this... i'm still not 100% happy with that solution. i always need to get, set and save the new class in the template files. that seems not the best solution. i tried to create a function addClass($element, $class) with this content: /** * add class to given element * * @param string key of element * @param string class * */ function addClass($element, $class) { $classes = wire('classes'); $classes[$element][] = $class; wire('classes', $classes); } but that does not have any effect. if anybody could give me some hints what is going on and why, that would be great
  7. i'm really looking forward to client side image resizing and i know that some kind of improvements are planned for 2016... but most of us do not know what exactly is being planned. wouldn't it be great (for us and also for ryan and the team) to get some feedback BEFORE starting development? something like a thread in the forum (or a sub-forum to the existing wishlist section) where an insider spreads some plans about next months development and we can give feedback and communicate the things that should not be missing. for example for the image field i think it would be great to have the possibility to set some predefined variations created by the client before upload. for example for an image gallery settings width 100 for thumbs, width 800 for detail, width 1920 for full res... i know ryan is a pretty good mind-reader but do you think some kind of community involvement would make sense here? maybe some kind of additions would be easier to implement when starting from scratch than changing some parts after the initial release... or would i just post such kind of things in the wishlist forum? i still think it would make sense to have a short checkup short before starting development...
  8. actually i'm only very eager about client side image resizing. i know that this is on the roadmap for 2016 but that can be everything between next blog post tomorrow and december maybe you have some more details? i'm getting offtopic here so i started a new thread in pub: https://processwire.com/talk/topic/12861-feature-wishlist-for-shortly-planned-developments/?p=116757
  9. thank you and sorry for not reading carefully enough
  10. hi kongondo, if i get you right, this module is intended to be used on frontend, isn't it? in the demo, though, it is used in backend with your media manager. would it be hard to get some kind of replacement of a standard image field directly in the backend?
  11. hi soma, i was doing exactly this, but i did not get it working with arrays. is your post related to mine? edit: i think it works as long as i stay inside _init.php but i want to modify the array in template files...
  12. hmmm, came across the "indirect modification of overloaded property" error today and found this thread... thank you lostkobrakai for that snippet $this->wire('variableName', $obj); it works, but only as long as i do not try to modify that variable in a template file. my setup: (delayed output) _init.php $test = array('one', 'two', 'three'); $this->wire('testarray', $test); template XY included via wireRenderFile() $testarray = wire('testarray'); // $testarray = [one, two, three] $testarray[] = "four"; // $testarray = [one, two, three, four] _main.php // wire('testarray') = [one, two, three] // why is four not stored in the array? what i was trying to do is to make some classnames configurable during runtime. i have a repeater matrix for some content blocks. they get rendered into the same parent div and i want to add classes dynamically depending on the items that are contained in the repeater. my workaround is setting the parent div's classname via switch($page->template) { case 'blog': $class = "demo class blog"; break; ... default: $class = "demo class"; break; } // html <div class="<?= $class ?>"> // foreach repeaterfield echo item->render() </div> thats not ideal. i would like to set the parent class directly in the file with the code for the field-render like this: <?php $democlasses = wire('democlasses'); $democlasses[] = "my-sample-blog-parent-class"; ?> <div> // my blog markup </div> any hints how i can get a configurable array in my templates? until now i just needed some global variables and storing them just like this worked fine: // _init.php $config->demovar = "demo"; // template $config->demovar = "newdemo"; // _main.php echo $config->demovar; // newdemo hope i made myself clear edit: i tried with wirearray at first (to have something like parentclass->add('blog') ) but i had the "noinstanceof wire" problem. there was a tread about this some days ago but i was not able to find it any more... any help very welcome
  13. hi owzim, i've used your module in the past quite a lot without problems. thank you for that. now i tried to use it in the new matrix repeater on 3.0.12 and this is what it looks like: seems to work fine with 3.0.12 when you add it in the normal way to a template. in the repeater it does not support code highlighting and also the settings will get lost on save. any chance that we get an update on this? although i have to say it is not critical for me as this is only ment to copy&paste some code to my blog and i will not write much code directly there... edit: note that i also tried setting "PHP" not "plain text" as the screenshot shows...
  14. working the first time with repeater matrix today and it is totally awesome!! repeater items are just normal pages and you have all you need there: current repeater-item available under $page variable; field in your repeater-item-type = $page->yourfield; current page, where your repeater matrix lives on = $page->getForPage(); don't know how that plays together with your module - i'm quite busy right now
  15. Hi gebeer, Sounds like a very interesting project! Would be great to have some insights in the showcase section when you're done
  16. just had to do a simple 1-level menu on my new website and was once again surprised how easy things can be with the great API. i was doing navigations like in the examples above but today i took a slightly different approach that in my opinion is a little bit better to read and maybe easyer/cleaner to understand: function renderMenu($page) { // get the root page $hp = wire('pages')->get('/'); // set pages that should have "active" class // remove root page otherwise this would always be active // if current page == rootpage it will be appended and set active $active = $page->parents ->remove($hp) ->append($page); // set pages that should be shown in the menu // easy in this case because it is only 1-level $menuitems = $hp->children ->prepend($hp); // return the markup $out = ''; foreach($menuitems as $item) { $cls = ($active->has($item)) ? ' class="uk-active"' : ''; $out .= '<li' . $cls . '><a href="' . $item->url . '">' . $item->title . '</a></li>'; } return $out; } or with less comments and most on one line: function renderMenu($page) { $hp = wire('pages')->get('/'); $active = $page->parents->remove($hp)->append($page); $menuitems = $hp->children->prepend($hp); $out = ''; foreach($menuitems as $item) { $cls = ($active->has($item)) ? ' class="uk-active"' : ''; $out .= '<li' . $cls . '><a href="' . $item->url . '">' . $item->title . '</a></li>'; } return $out; } of course that is really a little difference to the examples above, but sometimes for me it got a little confusing to handle the "active" class with some IFs and ORs and ANDs and the approach with prepend() append() add() or remove() may be more elegant. another thread for reference if anybody is having trouble https://processwire.com/talk/topic/288-solved-navigation-current/
  17. ...and you tell him, that you will do the backend with processwire, what comes out is this: http://kreativan.net/blog/news/website-relaunch/
  18. hi, i read some articles and also some forum posts about retina images, but did not find a really good answer. i found this module: https://processwire.com/talk/topic/8088-textformattersrcset-responsive-images-with-hidpi-lazyload-and-much-more/ but i'm doubtful because it's only linked once and never mentioned anywhere else... http://caniuse.com/#feat=srcset states no support on IE http://caniuse.com/#feat=picture is even worse?! do you use something like that? https://www.smashingmagazine.com/2014/05/picturefill-2-0-responsive-images-and-the-perfect-polyfill/ all the articles i find seem to be from 2014... how do you guys do that in 2016? thank you for your help!
  19. On mobile... There is a setting in the admin (access tab) If you select 'Yes' you can define what roles have access to pages using this template. If you select 'No' then pages using this template will inherit access from their parent pages.
  20. no, this is correct (meaning you share all the user account across the different domains). you have a standard pw installation. the only difference is that some of your pages are accessible via different domains. users, templates etc. are the same like in a 1-domain-installation. you can manage access just like you would in any other pw project, maybe using adrians pagebrancheditable: userA can manage branch siteA.com, userB branch siteB.com and so on... don't know what you mean by "front end users" though... why don't you just make a test-installation and play around?
  21. hi danjuan, welcome to the forum! this would definitely be possible using processwire, but it would not be a very simple task... i think you will get help here whenever you need it, but it is better to provide as much information and as much detailed questions from your side as possible. we can also not know how experienced you are and according to that the answers would differ significantly. your question is a little bit like. "hey, i discovered processwire yesterday. how can i build something like facebook?" obviously most of us can't provide such kind of help here in their spare time so please be more specific and show what knowledge you already have and what you already tried on your own to reach your goals.
  22. found this one today by coincidence: http://www.unphp.net/decode/d12d16b2fd7b1e49d2a9d3a7d26fe948/ seems to return a good result at least in this case...
  23. hi nikosch, thank you for your effort on this. it would be really great to give everyone a quick and easy impression of your module with a tool like licecap. example & link are here: https://processwire.com/talk/topic/11757-page-add-comfort-option/ thank you again
  24. outputformatting is always off when bootstrapping pw so your file-fields will always return arrays no matter what the setting in the admin is ps: yeah - the once in a lifetime moment when adrian has already posted a reply and i added (little) additional value with my answer. i will print that post and hang it up in my living room
  25. worked like a charm just installed it on several of my domains as one of my certs ran out and it is so easy: https://devblog.plesk.com/2015/12/lets-encrypt-plesk/ there's also an option to secure your plesk panel now (think this was not there from the beginning?!)
×
×
  • Create New...