Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/15/2014 in all areas

  1. I have been involved with computers and communications professionally since 1977 (that's a long time). I say that to tell you that from what I have seen on this forum, the people contributing are doing it from the graciousness of their heart. They are caring professionals who are making a living mostly as Developers or Designers. They could simply let you wither and don't provide the information. That's not how things are working on this forum. I believe that if you truthfully went back over all of your forum postings, you would immediately see what some have rightfully mentioned to you. There have been numerous posts where you are given the answers and then you go on to another tangent (not taking the valuable advice and working with it). Everybody learns differently. Some will grab onto knowledge faster than others. None of the comments are meant to demean you. The fact that they answered your posts and gave you valuable information shows that they actually care that you learn ProcessWire. You seem to want to do all of the hard stuff first, bypassing the low hanging fruits of ProcessWire. You need to do your part. One part is to take your own time and read some reference materials or take a PHP online course. There are many free resources on the Internet that will provide the missing logic that is holding you back. I believe you are very close to having that "Aha" moment, but you need to persevere, not lash out at people who are freely providing you with all the quality answers. It's a testament to the quality of individuals on this forum that you have been fortunate to have gotten as much help so far. We all want you to be a part of this community and thus we attempt to guide you in a different manner of learning. You need to be able to take constructive criticism because that's a lesson anyone needs to know in the real working world. Good day and good luck. Charles
    8 points
  2. madalin, PW 2.4 manages themes a little differently. Unfortunately most (all?) of the third party themes have not been updated yet. Here are some instructions on how to get it to work: https://processwire.com/talk/topic/4650-new-processwire-admin-theme-on-dev-branch/?p=53671 However honestly I think you are better off sticking with the default theme at the moment - there is a lot of new functionality in there that the old themes don't support. I also know that there is a second 2.4 specific theme just around the corner, and I am sure more will follow.
    7 points
  3. Fun read while drinking coffee
    6 points
  4. For the benefit of other module authors (or module "bundlers") I've just pushed a new module up to github that allows you to do a "one-click-install" of an entire set of modules. I know about the "installs" option for modules but believe that this offers a neater solution in some scenarios. For instance; it allows all of the sibling modules to be written without the need to define any 'installs' relationship between them - which could be particularly useful for later bundling of otherwise unrelated modules. It also keeps the modules UI clutter to an absolute minimum - all the user sees in the UI is just one module to install rather than all the modules that the package holds. There is a demonstration 'project' here that you can install to see what this module does for you - specifically: how it simplifies the UI for the installation of 5 other modules. Please note: This is an infrastructure module targeted at module authors or folks who otherwise create 'bundles' of modules. It isn't something you will want, of itself, for any site. (Which is why I'm not posting it to the module repository.)
    4 points
  5. @bwakad, just one more thing: if you feel that asking questions is the best for you, then ask. No one here is annoyed by them, or we would just ignore. As you must have noticed, people here like to answer to questions, even if they are basic or don't even seem to make sense. When someone points it out to you that you shouldn't be making a specific question, it's not because they don't want to answer, but because that question shows that you didn't look for things the right way. When Martijn points out that you need some basic knowledge of PHP before asking about site optimisation, it's because you are clearly inverting the priorities on your learning process, not to criticise. Sometimes it feels like your learning process is a bit like the sentence you have on your profile
    4 points
  6. As Martijn said, $this can never be used in a static context (ok in PHP actually it's possible but very dangerous). You could move the initialization with the translations into the constructor, it should work: class SomeModuleName extends WireData implements Module, ConfigurableModule { /** * Returns gender type * * @static * @return string */ private static $gender = array(); public function __construct() { self::$gender = array( 1 => $this->_("Male"), 2 => $this->_("Female"), ); } }
    4 points
  7. All together I did had valuable feedback from Nik @bwaked:Respect to Nik, but I think the most valuable advise here is from cstevensjr. I also don't wish to sound rude so please don't take this as so; When other users take the time to reply to your questions you need to do likewise - take the time to study their responses before plunging onward. I have been guilty of the same myself at times, but have bben around this community a little longer than you and have come to realise there is an immense amount of knowledge among members - more-so than most communities - and usually their answers are spot-on so long as the question is clear and precise. Sometimes it just takes a little extra study of their responses to understand them. You will get a much more positive response from members if you treat their responses like the gold dust they usually are Onward bro....
    3 points
  8. @bwaked: Your topic starts with about script optimising, quality answers are given. Then you start a whole other topic about assets loading. A good discussion comes out of this. Then out of the blue you switch to PHP include performance. For PHP functions and stuff, there's google to find valid answers to your PHP questions. I'm sorry, we are not Stack Overflow. We are the ProcessWire forum. We as developer all have to learn. We all have to search or test for the answers we need. It's just to easy to ask all questions and letting other people answer/work for you. Then you're not letting me know that you're picking up these answers, there's not much response. Lack of PHP knowledge on your side, makes it difficult for you to have a clear overview I guess. But PHP can be learned by study. That your part. And then there is the language thing as we both speak better Dutch then English.
    3 points
  9. Your PHP code isn't interpreted as PHP, but sent directly to browser. If another PHP file works fine, this does indeed sound strange. Just to make sure, is this a Linux host, is the web server Apache and have you had any issues with .htaccess (or mod_rewrite) before on this server? What about PHP version, could you check that too, just to make sure that it meets the requirements? Also: are you aware of anything else that could be somehow off with this host, i.e. safe mode turned on, suPHP in use or any other "non-typical" detail?
    3 points
  10. Or if you are lazy like me... This should work as well, I think... $session->redirect($page->child()->url); In some cases, can be a good idea to first check if page actually has children ... if($page->numChildren) $session->redirect($page->child()->url) Oh, and welcome to PW! Edited: corrected code, etc...
    3 points
  11. either you modify the links while creating the menu, like in this approach: https://processwire.com/talk/topic/4261-parent-pages-and-their-behavior/ or you put this in the template which wraps the child pages: $session->redirect($page->children->first()->url);
    3 points
  12. Nope, but they are kind of really case-related. But you can take a look if you want to. Here are the files: shop hack.zip -- I added two new fields additionally to each product: sc_shipping (The shipping costs) and sc_tax (the input should be like 0.07 or 0.19 (because 19% => 0.19)).
    3 points
  13. I do think optimising is not a bad thing at all, but I think it's a little bit of a trend. If the optimising is simple to do like compression With GZip do it. If there's an automated process that caches the compressed results and servers the cached version back with proper headers go for it. Modern desktop browsers can load 6 assets parallel from the same url ( sub domains make an other 6 lanes free etc etc. ), and for mobile it's mostly 2. So bandwidth optimisation depends on platform. Then you have HTML CSS Javascript optimisation. If you break the paint process of the browser, the browser has to repaint the whole site. Javascript is a great behaviour changer of the dom, so if the js changes the positions, size etc etc, the whole dom has to be repainted. The function you have above is a nice function for compression (saving a little on bandwidth), but it has to do it on every request. The expense here is for the server. It'l do fine if you don't have to many visitors I guess. A minimise function should contain 3 basic things if you ask me: 1.) The minimizer 2.) Caching from the minimised. 3.) Send proper headers, while serving or not serving the cached results back. But for little sites, with not much traffic a few kb more isn't a problem I think. In perspective, if you optimise 1 not optimised image you save way more KB's. I do think if you have 3 or 4 js files, concatenation isn't a big concern. Say if you have 7, 8 or more you could look at Davids minimiser.
    3 points
  14. Previously I posted about Textareas. The next field coming in ProFields is called Multiplier. This field lets you take almost any existing single-value Fieldtype, and use it as a multi-value Fieldtype. Single value Fieldtypes are those that store one piece of information at a time, for example: Text, Textarea, Integer, Float, Email, URL, etc. Any of these, and more can be multiplied with Multiplier. Here's a short video introduction to Multiplier. Like with the previous screencast, I recommend upping the quality to 720p and viewing full screen. This one also includes narration, though we're in allergy season here so my voice is a little rough. The next fields I have to tell you about in a few days are: Table, PageTable and AutoLinks.
    2 points
  15. In general: I don't want to be rude as well, but many times it comes to that level (in answers) - it's always difficult to express yourself in written words. True I do not know all basics from memory. And I appreciate all answers, especially the one that can learn me something. But I have had the same answer (go study) on a question about functions, although functions in PHP are not very basic. How valid is such an answer? If we say 'studying some basic php' - and I add -> before we ask - it's basically telling me (and maybe others) 'not to ask any kind of questions'. But then again, who decides which question has to do with basic PHP? Questions are never without a reason. You learn from the answers and tips when people trying to help. It is never of use to only one person. It can be of use to many. And for the record: People study PHP, even basics for years, and still ask questions of any kind, including mine. Since this topic is marked as a HOT topic I do not think it is a wrong question! Among us (also in this topic) are developers with advanced skills in PHP whom debate about it. I did not see anyone tell them to study basics!? I hope this has nothing to do with the time being a member or not being a contributor. I merely ask questions when I do not understand or need some tips. The most easy thing to do is tell someone to study. The most difficult part is to put people on track.
    2 points
  16. "process to assign....": This tells me you are assigning your 'settings' page the 'wrong' template. Do not assign it the admin template. 1. First create your own template (no need for a template file; just the template). Call that template, say 'settings'. 2. Add the fields you want to that template. 3. Go to Admin (I mean the page Admin in the page tree), create a new page under the 'admin' page. Call it 'settings', give it the template 'settings'....you are good to go.. .... Pages under admin can only be seen by the 'supersuser' - so, no worries that people with the wrong permissions will see it . In addition, as I stated, these pages cannot be directly accessed via the frontend + your page will not have a template file....(not that it matters since this is an 'admin' page). Have you read up on the docs about how PW works? If not, you might want to do that first
    2 points
  17. Hi Madalin, Welcome to ProcessWire and the forums! There are a number of ways to achieve this. If it is only a settings page, then you can create the page as a direct child of Admin. I don't know what you mean by "to show as tab with some functionality" but the page should show up as a menu item in Admin. You will need to have a template for that page, of course. Add as many fields as you want to that template that will be used by your "settings" page. You can then pull up data from that page using the PW API, in this case you would want to use $pages since pages in Admin cannot be accessed directly in the frontend (so no $page). To output your settings fields...example.. echo $pages->get(12345)->title//Here, 12345 is the ID of your settings page. You can also retrieve the page by its path or title or name... Have a read here http://processwire.com/api/variables/pages/ http://processwire.com/api/variables/page/
    2 points
  18. This is my version of Ryan's starter: $requested_pid = (int) $input->get->pid; $t = $pages->get($requested_pid)->path; if($user->isLoggedin()){ if($requested_pid == ''){ $session->redirect('/'); } else{ $session->redirect($t); } } if($input->post->username && $input->post->pass) { $username = $sanitizer->username($input->post->username); $pass = $input->post->pass; $u = $users->get($username); if($u->id && $u->tmp_pass && $u->tmp_pass === $pass) { // user logging in with tmp_pass, so change it to be their real pass $u->of(false); $u->pass = $u->tmp_pass; $u->save(); $u->of(true); } $u = $session->login($username, $pass); if($u) { // user is logged in, get rid of tmp_pass $u->of(false); $tmp_pass = $u->tmp_pass; $u->tmp_pass = ''; $u->save(); // now redirect to the profile edit page if($tmp_pass == $pass){ $session->redirect('/profile/'); } else{ $session->redirect($t); } } } // present the login form $headline = $input->post->username ? "Login failed" : "Please login"; $content = " <h2>$headline</h2> <form action='./?pid=".$requested_pid."' method='post'> <p> <label>Username <input type='text' name='username'></label> <label>Password <input type='password' name='pass'></label> </p> <input class='bluebutton' type='submit' name='login' value='Login'> </form><hr /><br /> <p><a href='/reset-pass/'>Forgot Password?</a></p> "; Then wherever you have a link to login: <a href="/logout/?pid='.$page->id.'">Login</a> Of course you can do the same with logout too. Hope that helps
    2 points
  19. 2 points
  20. I don't want to be rude here @bwaked but the optimisation you need is studying some basic PHP. I think thats more important then trying to squeez out a few hundreds of a second with methodes you don't understand yet.
    2 points
  21. You can't use $this in static. Have you tried __("Male"); ?
    2 points
  22. It's been a while since I first made this site, and there has been some updates The old site design which I first posted about was kept on corporate.ccw-global.com and I've done bootstrap based redesigns (UI focused) for www.ccw-global.com and hk.ccw-global.com Processwire has allowed or content writer to plant focused article/blog feeds and maintatin a SEO friendly URL structure. Article feeds are like those found on: http://hk.ccw-global.com/specialist-insurance/specialist-articles/ http://hk.ccw-global.com/health-insurance/resources/articles/ We've been able to upload TONS of pages, and keep them well organized with PW's nice backend and were able to use custom fields extensively to allow content writers to insert proper meta-data. Very happy with how it's working for us. Almost forgot, we added muli-language capability on http://www.ccw-global.com/es/
    2 points
  23. http://modules.processwire.com/modules/all-in-one-minify/ http://modules.processwire.com/modules/minify/ http://modules.processwire.com/modules/minify-html/
    2 points
  24. Optimizing on this level would have minor benefits that it would hardly be noticable. I would recommend limiting the amount of assets you load, the lesser the request to your server the faster the page will load. Secondly to have a lot of speed aprovement i can recommend the ProCache module that Ryan wrote. Altough i found a couple of things that you could change in your code: echo "<li><a href='{$pages->get(1026)->url}'>{$pages->get(1026)->name}</a></li>"; // I would recommend changing it so you only have one request for $page->get() $item = $pages->get(1026); echo "<li><a href='{$item->url}'>{$item->name}</a></li>"; $menu = $pages->find("template=browse, parent=1, sort=title"); foreach ($menu as $item) { ?> <li><a href="<?php echo $item->url ;?>"><?php echo $item->title;?></a></li> // I would recommend changing it, not switch php html, and sort by name its significant faster that sorting by title $menu = $pages->find("template=browse, parent=1, sort=name"); foreach ($menu as $item) { echo "<li><a href='{$item->url}'>{$item->title}</a></li>"; Regarding the amount of javascript files you load, you might want to compile those to one file and server that (possible minified and gzip compressed). There are scripts or modules that can do that on the fly (sorry, i dont have an URL at this moment).
    2 points
  25. Here's a video of a module we're working on that I thought you guys might like. The module, Lister, provides a different type of Page List than the tree that you usually interact with in ProcessWire. It gives you a table of pages with customizable columns, filters and actions. Rather than try to explain what it does, I figured I'd show you. This module also uses a new (soon to be released) Inputfield invented by Apeisa, developed by me, and sponsored by Avoine, called InputfieldSelector – it's what you see on the configuration screen as well as the Filters tab. I recommend bumping up the size/quality to 720p so that you can properly see everything. The video has no sound... I tried to do one with narration, but that didn't work out.
    1 point
  26. Does anybody here visit the Beyond Tellerrand conference next week? I will arrive in Düsseldorf at sunday evening together with a coworker. Could be a good occasion for a mini ProcessWire Meetup.
    1 point
  27. Just spotted a PW on Nginx installation tutorial on how-to-forge. I quite like that site - find it useful from time-to-time - so big thanks to Falko Timme for taking time to write it up. Nice
    1 point
  28. Hi guys I'm going to be building my first processwire site for a friend. I've found a hosting provider and I just wanted to check that the hosting package has all the requirements I need to run a process wire site. From what i can see it does but I'm not too sure with these things. I'm a designer / front-end guy but I've never put a site live before so any feedback would be very helpful before I purchase. I would be looking at the Business package from this link http://www.uk2.net/web-hosting/#tech-specs Really enjoying processwire so far. Fantastic CMS! Thanks in advance for any help provided.
    1 point
  29. https://processwire.com/talk/topic/15-how-do-i-create-a-page-that-redirects-to-its-first-child/?p=25
    1 point
  30. Oh figure it out =D! I added the permission in the installer and uninstaller function. Then on my client role I gave it the shop_orders permission. (You can also do it manually in the back end) public function install() { $permission = $this->permissions->get('shop_orders'); if (!$permission->id) { $p = new Permission(); $p->name = 'shop_orders'; $p->title = $this->_('view Order mangement'); $p->save(); } } public function uninstall() { $permission = $this->permissions->get('shop_orders'); if ($permission->id) { $permission->delete(); } } //Also needed to modified this line and added check_access $orders = $this->pages->find('template=sc-order,limit=20,sort=-created, check_access=0'); I didn't realize that you can set permission in modules in the getModuleInfo() public static function getModuleInfo() { return array( 'title' => 'Orders Management', 'summary' => 'Manage Shop orders', 'version' => 002, 'permanent' => false, 'singular' => true, 'permission' => 'shop_orders', <------- 'requires' => array( "ShoppingCart", "ShoppingCheckout" ) );}
    1 point
  31. Nice shortcut, did not know it existed. But I think it's less expressive =)
    1 point
  32. that´s what I meant with:
    1 point
  33. If we talk about requests we talk mainly about round trips. Browser receives HTML -> finds assets ( scripts styles images fonts etc. ) the browser ask a server to serve those -> the browser get them back. Say you've 10 JS scripts, AIOM combines them to 1 saving your site from 9 round trips. This part I don't understand. If the code from your function is cached & served with proper headings, the next time the browser visits the file it'l tell the browser 304. Then the browser will get the file out of the browser cache. ( maybe only the header is send back, (not sure here), but never the whole file )
    1 point
  34. A good read about the static keyword.
    1 point
  35. In the same server we have a simple file (.php) and he works fine. I'm making a form to upload file, this is my code: <form class='forum-form' accept-charset="utf-8" action='./formrms' method='post' enctype='multipart/form-data' > <input type='file' id='attach' name='attach_file' multiple='multiple' accept='image/jpg,image/jpeg,image/gif,image/png' /> <!-- this is the input tag for the image attachment --> <input type='submit' name='add_file' value='Add file'/> <!--this is the submit to upload image attachment before submitting entire form --> <input type='submit' name='form_submit' value='Submit'/> <!-- this is the submit to send entire data --> </form> <?php if ($this->input->post->add_file){ $this->uploadImage(); $attached_file = $this->session->attach_markup; } ?> And this is the result: https://dl.dropboxusercontent.com/u/80634129/error.png I'm here "/site/templates/formrms.php", then I'm not in the admin templates.
    1 point
  36. The alert I got refers to the domain where it was uploaded, so the free server service might be the issue? Can you PM me the URL to their service and I can confirm.
    1 point
  37. You're not putting it in the Body field in the admin are you? Because your PHP should be in the /site/templates/yourtemplate.php file.
    1 point
  38. Hey, I finally had the chance to use PW for a german shop. And let me tell you setting up an online shop under german law is the worst. For example there are different taxes for different products (7% on book and stuff 19% on everything else). And you have to apply this tax even on shipping costs (like shipping costs tax for books 7% ...). And you need to have checkbox you have to check that you "read and understood the "general business terms". And your bux button has to say "buy" not "complete checkout". It has to be "buy" (or something similar). So I had to do some core hacking of the shop module. but it works now. Take a look: www.oliver-mark.com/shop/ -- Nico
    1 point
  39. Uhm, I'm using this since years in macos to maximize the window. The only tool I have and can't live without is TotalFinder.
    1 point
  40. ___uninstall is hookable. You could write a before hook that will replace the uninstall This example is for $this->pages but you can change that to your needs public function init() { $this->pages->addHookBefore('uninstall', $this, 'myUninstall'); } public function myUninstall(HookEvent $event) { // replace original method $event->replace = true; }
    1 point
  41. I think this thread fits my question as well I´ve talked to david-karich and he told me that it´s probably better to have inline styles, at least for above-the-fold content So I thought about having the whole stylesheet in the head like ages before, but get it included and minified to still have structured code for maintenance Wrote a little function function minCSS($styles) { foreach($styles as $style) { $buffer .= file_get_contents($style); } $buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer); $buffer = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $buffer); $buffer = str_replace(': ', ':', $buffer); $buffer = str_replace(' {', '{', $buffer); $buffer = str_replace('{ ', '{', $buffer); $buffer = str_replace(';}', '}', $buffer); $buffer = str_replace('; ', ';', $buffer); $buffer = str_replace(', ', ',', $buffer); $buffer = str_replace(' + ', '+', $buffer); $buffer = str_replace(' > ', '>', $buffer); $buffer = str_replace("url('../", "url('/site/templates/", $buffer); $out = "<style type='text/css'>"; $out .= $buffer; $out .= "</style>"; return $out; } now I can echo minCSS(array('styles/style1.css', 'styles/style2.css', 'styles/style3.css')); is it worth saving this request?
    1 point
  42. ....nothing to see here, run along, ta ta...
    1 point
  43. Just A guess... The user template doesn't have a title and PageAutocomplete uses title to find the pages.
    1 point
  44. If I would live in California it would also be a no-brainer for me, but in Europe we pay the double unfortunately...
    1 point
  45. Can one do that? Build custom access controls? That'd be awesome. For now: Let's say you have the following structure: Pages - Page 1 - PageField 'userGroupSelect' - user-group-1 - Page 2 - PageField 'userGroupSelect' - user-group-2 - Page 3 - PageField 'userGroupSelect' - user-group-3 User Groups (which are pages) - User Group 1 - PageField 'userSelect' - user1 - user3 - User Group 2 - PageField 'userSelect' - user2 - user3 - User Group 3 - PageField 'userSelect' - user2 - user3 the following code would get you the references: // the user you want to get references for $targetUser = $users->get("user3"); // find pages that reference users $userReferences = $pages->find("userSelect.count>0"); // create empty page array, which will contain the matching groups $groupsWithUser = new PageArray(); foreach ($userReferences as $userReference) { if($userReference->userSelect->has("id={$targetUser->id}")) { $groupsWithUser->push($userReference); } } // find pages that reference user groups $groupReferences = $pages->find("userGroupSelect.count>0"); // create empty page array, which will contain the matching pages $pagesWithGroups = new PageArray(); foreach ($groupReferences as $groupReference) { if($groupReference->userGroupSelect->has("id={$groupReference->id}")) { $pagesWithGroups->push($groupReference); } } foreach ($groupsWithUser as $groupWithUser) { echo "{$targetUser->name} is referenced in User Group '{$groupWithUser->name}'<br>"; } foreach ($pagesWithGroups as $pageWithGroups) { echo "{$targetUser->name} is referenced in Page '{$pageWithGroups->name}'<br>"; } Perhaps there is a more elegant way, dunno. But as I said, you would want to wrap that logic into a custom hook for users, like $user->isInGroup('user-group-1') or $user->isReferencedOnPage('some-page-name') or something similar.
    1 point
  46. I have managed to get imagick setup locally (after many hours!) - I will test and post results as soon as i have time (using wampserver php 5.3 on vista 32 bit, had to use image magick 6.7, as the latest 6.8.9 wouldn't play nice - not got time upgrade my wamp right now. I have a newer version (php and image magick, 64bit linux) on my server, so will be interesting to compare results. I am most interested in the imagick::INTERPOLATE_xxx functions, as GD2 is giving me horrible results for upscaling images more than 200% (looks to be nearest neighbour, not even bilinear). I think it is very good to be moving to an image-library agnostic approach to ImageSizer, so that one can just drop in gd2, Imagick, etc. Yes I did ask about the naming conventions, what you have written so far looks good - i will see if i can think of any other suggestions for it (add the interpolation method?) also, may be useful to set a different default method for upscaling vs downscaling.
    1 point
  47. See the user comments section on the strftime reference at php.net. There appear to be lots of feedback and means of working around this issue with strftime.
    1 point
×
×
  • Create New...