Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/10/2014 in all areas

  1. Hello everyone, This is just a little admin theme redesign. Just made "pages" at the moment, but let me know if you want me to continue, and which version you prefer
    5 points
  2. I am glad to announce first release candidate of stable Czech Language Pack for ProcessWire 2.4. Czech Language Pack Current version: 1.0rc1 (99 files) + README.txt Changelog: Added: wire/templates-admin/default.php wire/templates-admin/debug.inc Deleted: wire--modules--admintheme--adminthemedefault--debug-inc.json wire--modules--admintheme--adminthemedefault--functions-php.json wire--modules--admintheme--adminthemedefault--default-php.json Updated: Many strings and cleaning.Czech Language Pack for external modules. Current version: 0.5 (25 files) + README.txt Added: ShoppingCart (initial translation) site/modules/ShoppingCart/PaymentInvoice.module site/modules/ShoppingCart/PaymentSimpleExample.module site/modules/ShoppingCart/ShippingFixedCost.module site/modules/ShoppingCart/ShoppingCart.module site/modules/ShoppingCart/ShoppingCheckout.module site/modules/ShoppingCart/ShoppingOrdersManagement.module site/modules/ShoppingCart/ShoppingStepsMarkup.module Updated: ModulesManager InputfieldCKEditor Contains: FieldtypeCropImage InputfieldCKEditor TextformatterVideoEmbed FormBuilder ModulesManager ProcessPageDelete ShoppingCart pw_czech_1rc1.zip pw_czech_modules_05.zip
    3 points
  3. InputfieldWrapper is the base class for a Form, Fieldset or Tab (InputfieldForm, InputfieldFieldset, etc.) It implies an Inputfield thats purpose is to contain other Inputfields. While Forms, Fieldsets and Tabs represent specific things, a regular InputfieldWrapper just acts as a wrapper/container for Inputfields, without any kind of visual representation. Because it is a type of Inputfield, it can take the place of a single Inputfield, while actually containing many of them.
    3 points
  4. Quick 'n' dirty guide if you want a single page tree with the same content in different languages. The URLs will then look like example.com/en/my-article or example.com/de/mein-artikel 1:) Download and install ProcessWire 2:) Install the modules you find under the "Language" Tab. 3:) Go To Setup->Languages and add new languages. Please note, that the default one is also the default language of your site* 4:) For every field type text or textArea change the Type to TextAreaLanguage or TextLanguage. (e.G. body with TextArea becomes body with textAreaLanguage). You fields should now have multiple tabs for each language, if you edit a page. 5:) Go to the root page (/) and look under "Settings" Setup an URL for every language, e.g. en,de,ru,... . Looks like this: http://take.ms/34Tq5 6:) Create pages and fill in the content. You can build a front end language switch as described in Ryans API Language page. ProcessWire will take care of changing URLS (e.g. /en/example to /de/beispiel) and you can access the current language via $user->language; *It's possible later to define another language as the default language.
    3 points
  5. One option is to install a self-signed SSL Certificate on your local machine. There are numerous instructions on how to do this on the Internet. I have referenced one that applies to Windows users to get you started. http://www.howtogeek.com/107415/it-how-to-create-a-self-signed-security-ssl-certificate-and-deploy-it-to-client-machines/
    2 points
  6. Here are some API additions to the dev branch, primarily for WireArray/PageArray/etc. I've found these very handy lately, and would have on almost any project I worked on, so decided they'd add value to the core. I'll add these to the cheatsheet once 2.4 replaces 2.3, but for now, here they are. The examples here use PageArray, but note that these API additions apply to any WireArray derived type, not just PageArray. WireArray::implode() Implode all elements to a delimiter-separated string containing the given property from each item. Similar to PHP's implode() function. Usage: $string = $items->implode([$delimiter], $property, [$options]); Arguments: $delimiter - The delimiter to separate each item by (or the glue to tie them together). May be omitted if not needed $property - The property to retrieve from each item (i.e. "title"), or a function that returns the value to store. If a function/closure is provided it is given the $item (argument 1) and the $key (argument 2), and it should return the value (string) to use. [$options] - This argument is optional. When used, it's an array with modifiers to the behavior: skipEmpty: Whether empty items should be skipped (default=true) prepend: String to prepend to result. Ignored if result is blank. append: String to prepend to result. Ignored if result is blank. Examples: $items = $pages->find("template=basic-page"); // render all the titles, each separated by a <br>, for each page in $items echo $items->implode('<br>', 'title'); // render an unordered list of each item's title echo "<ul><li>"; echo $items->implode('</li><li>', 'title'); echo "</li></ul>"; // same as above, but using prepend/append options, // this ensures no list generated when $items is empty echo $items->implode('</li><li>', 'title', array( 'prepend' => '<ul><li>', 'append' => '</li></ul>' )); // same as above, but with all items now presented as links // this demonstrates use of $property as a function. note that // we are also omitting the delimiter here as well, since we don't need it echo $items->implode(function($item) { return "<li><a href='$item->url'>$item->title</a></li>"; }, array('prepend' => '<ul>', 'append' => '</ul>')); WireArray::explode() Return a plain array of the requested property from each item. Similar to PHP's explode() function. The returned PHP array uses the same keys as the original WireArray (if that matters). Usage: $array = $items->explode($property); Arguments: $property - The name of the property (string) to have in each array element (i.e. "title"). You may also provide a function/closure here that should return the value to store. When a function/closure is used it receives the $item as the first argument and the $key (if needed) as the second. Examples: // get an array containing the 'title' of each page $array = $items->explode('title'); // get an array containing the id, url and title of each page $array = $items->explode(function($item) { return array( 'id' => $item->id, 'url' => $item->url, 'title' => $item->title ); }); WireArray::data() Store or retrieve an arbitrary/extra data value in this WireArray. This is exactly the same thing that it is jQuery. I've personally found this useful when building search engines: the search engine can store extra meta data of what was searched for as a data() property. Then any other functions receiving the WireArray/PageArray have access to this additional info. For example, the search engine portion of your site could populate an array of summary data about what was searched for, and the render/output code could render it to the user. Usage: // Setting data $items->data('key', 'value'); // Getting data $value = $items->data('key'); // Get array (indexed by key) of all data $values = $items->data(); Arguments: The above usage section explains all that's needed to know about the arguments. The only additional comments I'd make are that 'key' should always be a string, and 'value' can be anything you want it to be. Example: function findSkyscrapers() { $floors = (int) wire('input')->get->floors; $year = (int) wire('input')->get->year; $items = wire('pages')->find("template=skyscraper, floors=$floors, year=$year"); $items->data('summary', array( 'Number of floors' => $floors, 'Year constructed' => $year )); return $items; } // the render function can focus purely on output function renderSkyscrapers($items) { echo "<h2>You searched for:</h2>"; // render the summary of what was searched for foreach($items->data('summary') as $label => $value) { echo "<p>$label: $value</p>"; } echo "<h3>Skyscrapers found:</h3>"; // note use of new implode() function, though a foreach() would be just as well here echo $items->implode(function($item) { return "<p><a href='$item->url'>$item->title</a></p>"; }); } WireArray::and() WireData::and() Return a new copy of the WireArray with the given item(s) appended. Primarily as a syntax convenience for various situations. This is similar to jQuery's add() and andSelf() functions, but I've always felt "add" implied adding something to the original rather than creating a new combination, so went with "and" in this case. The term "and" is actually a reserved word in PHP, so you can't usually have a function named "and()", but through the magic of hooks, ProcessWire can. This function should reduce the instances in which you'd need to do "$a = new PageArray();" for example. Usage: // create a new WireArray with $items and $item (appended) $myItems = $items->and($item); // create a new WireArray with $items and $moreItems (appended) $myItems = $items->and($moreItems); // create a new WireArray with $items and $item (prepended) $myItems = $item->and($items); // create a new WireArray with $item and $anotherItem (appended) $myItems = $item->and($anotherItem); // create a new WireArray 4 items $family = $pappa->and($mamma)->and($brother)->and($sister); Examples: // generate breadcrumb trail that includes current page foreach($page->parents->and($page) as $item) { echo "<a href='$item->url'>$item->title</a> / "; } // check if page or its children has a featured checkbox if($page->and($page->children)->has("featured=1")) { echo "<p>Featured!</p>"; }
    1 point
  7. Nope, version numbers go like this: 5.3.0 5.3.1 5.3.2 5.3.3 5.3.4 5.3.5 5.3.6 5.3.7 5.3.8 5.3.9 5.3.10 5.3.11 etc...
    1 point
  8. I agree about the contrast. And i think i have to agree with teppo about the navbar. Here is a small update (i reduced the navbar width, like kongondo said, it was too large).
    1 point
  9. Hi pwired. No, it's just an image for the moment. You're right, i'll do that Thank you ! Here are 2 new propositions from first and third versions, for the page template. And I changed the look of the sidebar on the third one. The goal is to make it very simple and user-friendly.
    1 point
  10. Using modules for this stuff is nice if you are building functions you'll be re-using on multiple sites. But for the sake of simplicity, I usually put my shared output generation functions just in a common include file like this.
    1 point
  11. Ok step 1 and 2 in Philipps post were easy. After that I went back to Setup Languages Add New Any combination of letters (a-z), numbers (0-9), dashes or underscores (no spaces). I entered de (for deutsch) and clicked the Save button. Now under languages I have default and de If I click on de I see : Language Translation Files, Add files, json, zip Translate New File drag and drop files in here Save What are you supposed to do here ? Step4. from Philipps post I went to the body field and changed type from TextArea to TextAreaLanguagefield This message came up: Please note that changing the field type alters the database schema. If the new fieldtype is not compatible with the old, or if it contains a significantly different schema, it is possible for data loss to occur. As a result, you are advised to backup the database before completing a field type change. I checked Confirm field type change and clicked on Submit I went to a page that has a body field , Home, clicked on Edit, Under Body I see now 2 Tabs, Default and de This looks good. No time left for now, today my work starts at 10 - will try to find more time later on to continue.
    1 point
  12. And there you have it, the easiest multilanguage website in the history of CMSs
    1 point
  13. You're welcome. It depends on your needs. But as written in the introduction, the easiest is to use the "Language Support Pages Names" module. The great advantage is that you have one site tree for as many languages as you need. So in your case, each page of your site is created once and then you add the content in german and english. The fact that you can also define which page is published in which language makes it even more flexible
    1 point
  14. Hi mvdesign, Not sure I understand you correctly. But also when uploading with a "Jquery Uploader", the files are processed somehow server-side (PHP). And in PHP, accessing the uploaded files is done over the $_FILES array. Anyway, if the files are stored in a directory on your server, you can attach them to your pages like this. Note that this is code written in the browser and not tested. You can attach multiple images for example by looping through the files in your directory. $p = $pages->get('/path/to/my/page/'); $image = '/path/to/my/image.jpg'; $p->of(false); $p->images = $image; $p->save(); $p->of(true);
    1 point
  15. Just checking: you've tried creating output (into a variable, such as $out = "my markup goes here") and returning that variable (return $out), not just echoing it out directly.. and it doesn't work? It definitely should, so I'm guessing there's something weird going on. If you could post some sample code that causes issues, I'd be happy to take a closer look. Answer to your non-intended question is that you'll still have to render some inputfield markup there. This is probably easiest to explain with some code. Example below will output "my value" first, then render any inputfields this wrapper contains (in this case just one markup inputfield with value "some markup.") $wrapper = new InputfieldWrapper; $wrapper->attr('value', 'my value'); $inputfield = new InputfieldMarkup; $inputfield->value = "some markup"; $wrapper->add($inputfield); echo $wrapper->render();
    1 point
  16. Thanks Ryan. I tested my $article_page case with the last dev version and it works just as expected now. This really opens a huge potential for Hanna code regarding cross-fields referencing in a page independently of the rendering context.
    1 point
  17. I think it's a nice design, Designers should show of their skills on their own websites I also notice some JS quirks though. The dark background not always works, and I would much prefer "click/animation" to the dragging. A detail that I would definitely change is the italic "manifesto". I get the feeling that that's an artificial Italic and not the one designed for the typeface (the strange diagonal dot gave me that clue)
    1 point
  18. Or you could lookup all the Saturdays in a given time-frame and build a selector from this. I don't know the inner workings of the selector engine and the queries it produces so maybe not efficient at all, but i've tested it and it seems to work. $start = new DateTime('2013-12-31'); $end = new DateTime('2015-01-01'); // grab all Saturdays between $start and $end $periodInterval = DateInterval::createFromDateString('first sat'); $periodIterator = new DatePeriod($start, $periodInterval, $end, DatePeriod::EXCLUDE_START_DATE); // build selectorValues string $selectorValues = ''; foreach ($periodIterator as $date) { $selectorValues .= $date->format('Y-m-d') . '|'; } $selectorValues = rtrim($selectorValues,'|'); // 2014-01-04|2014-01-11|2014-01-18|2014-01-25 etc. $results = $pages->find("test_date=$selectorValues"); foreach ($results as $result) { echo $result->title; }
    1 point
  19. You guys are tough. My impression is that the site is awesome, something different with lots to discover and great visual rewards. It made me want to stick around. I've found this site and the one that Felix posted to be some of the most visually interesting and engaging sites I've seen recently.
    1 point
  20. This is one of those cases where an SQL query would be easier. WHERE DAYOFWEEK(date) = '6' But it probably isn't worth it to do an SQL query for such a simple situation, so you might be best just removing the non-Saturday dates from the results. $results = $pages->find("date>=2014-01-01, date<=2014-12-31"); foreach ($results as $result) { if (date('l', $result->date) != 'Saturday'){ $results->remove($result); } }
    1 point
  21. I think these guys covered it really well, but here's an overly simple alternate example in case it helps. class YourModule extends WireData implements Module, ConfigurableModule { public static function getModuleInfo() { return array('title' => 'Your Module', 'version' => 1); } const defaultValue = 'renobird'; public function __construct() { $this->set('yourname', self::defaultValue); // set default value in construct } public function init() { // while you need this function here, you don't have to do anything with it // note that $this->yourname will already be populated with the configured // value (if different from default) and ready to use if you want it } public function execute() { // will return configured value, or 'renobird' if not yet configured return $this->yourname; } public static function getModuleConfigInputfields(array $data) { // if yourname isn't yet in $data, put our default value in there if(!isset($data['yourname'])) $data['yourname'] = self::defaultValue; $form = new InputfieldWrapper(); $f = wire('modules')->get('InputfieldText'); $f->name = 'yourname'; $f->label = 'Enter your name'; $f->value = $data['yourname']; $form->add($f); return $form; } } If you have the need to manage several configuration values, then you can save yourself some time by using a static array of default values like in the examples before mine. Also this: foreach(self::$configDefaults as $key => $value) { if(!isset($data[$key]) || $data[$key]=='') $data[$key] = $value; } could also be written as this: $data = array_merge($data, self::$configDefaults);
    1 point
  22. Templates -> Filters -> Show System Templates : look for "admin" template. Edit and go to -> "URLs" and look for https etc.
    1 point
  23. First things first, the $user->language should be set based on the current domain its being accessed from. We'll assume that the subdomains match the language names, i.e. subdomain "fr.domain.com" corresponds with language "fr", as named in ProcessWire. Code like this should exist at the top of a common include file that gets run/included before others (I recommend using $config->prependTemplateFile to automate it for you, see /site/config.php). /site/templates/_init.php: foreach($languages as $language) { if(strpos($config->httpHost, "$language->name.domain.com") === 0) { $user->language = $language; break; } } Next, I'm not necessarily sure it's ideal to autodetect the browser language and redirect based on that. There will always be cases where this doesn't actually match the user's preference. It might (possibly?) be an SEO concern too. It also limits what you can do in terms of caching, since you have detection code that always needs to run. I think it might be better to present a default language and an easy path for the user to find their language. However, if you still want to do language detection from the browser, you can look at the http_accept_language header. We'll assume that your languages are subdomains use the same naming convention as the http_accept_language, which would be "fr", "en", "es", etc. $name = $sanitizer->pageName(substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2)); $language = $languages->get($name); if($language->id && $name != $user->language->name) { $url = "http://$name.domain.com" . $page->localUrl($language); $session->redirect($url); } I've found that flags don't always represent language well. For instance, for Spanish do you show a Spain, Mexico, or some other flag? I think what's better is to make the selection based on the native language name, i.e. "Espanol" for Spanish. This is easily recognizable to people looking for the language. As for implementation, there is a good code example for this in the API documentation: How to implement a language switcher. In your case, using different domains, the same strategy would apply except that you'd need to include the domain as part of the $url, i.e. // this for: de.domain.com $url = "http://$language->name.domain.com" . $page->localUrl($language); // or this for: domain.de $url = "http://domain.$language->name" . $page->localUrl($language);
    1 point
  24. Hi, @Wanze: when I set this then the umlaut in "Body" of news are not correct! I have the Blog-Template. My solution: Processwire is: 2.3.0 date-field is: %A, %d. %B %Y %H:%M in /wire/config.php: $config->dbCharset = 'utf8'; and $config->dateFormat = 'd.m.Y H:i:s'; in /site/config.php: $config->timezone = 'Europe/Vienna'; - but when default it doesn´t matter Database should be utf8_general_ci If you set this you get in Blog-News: Posted by admin, Dienstag, 26. M�rz 2013 10:32The only solution I found is to go in source: /site/templates/markup/post.php and include after first line: setlocale (LC_ALL, 'de_DE.UTF-8'); Now you get: Posted by admin, Dienstag, 26. März 2013 10:32 Now take a look at the archive: the month-name in the middle content and in sidebar is not correct. You must include the same code above in two files: /site/templates/markup/archives.php and /site/templates/archives.php This works for me.
    1 point
  25. It should be fine to put in a regular array (of non-objects), but I don't think a PageArray will work. Whatever you put in $session is best reduced to a native PHP type, so to stuff a PageArray into $session, I would typecast it to a string: $session->pageArray = (string) $pageArray; And to pull it out in the next request, pass that string to $pages->find(), which will turn it back into a PageArray: $pageArray = $pages->get("id=$session->pageArray");
    1 point
×
×
  • Create New...