Leaderboard
Popular Content
Showing content with the highest reputation on 08/17/2014 in all areas
-
Thanks for all the prompts to get this updated and out on GitHub, everyone. My apologies for not doing it a long time ago! Here's the modules directory entry: http://modules.processwire.com/modules/fieldtype-templates/ Out on GitHub: https://github.com/Hani79/Processwire_FieldType_Templates Shout out to @adrian for fixing the bug reported by @Raul and @lisandi3 points
-
There's no real support for placeholder parsing in the list_tpl, only on the item_tpl. The list_tpl has the %s that will get replaced with a class="..." string. There's a hookable method that is only for the css class string to hook into and add custom classes. So it's practically possible to use that with a little trick to add a string and would look like this: $menu = $modules->MarkupSimpleNavigation; $menu->addHookAfter("getListClass", null, function($event){ $class = $event->arguments("class"); $child = $event->arguments("page"); $event->return = $class . '" data-attr="' . $child->title; // closing " will get added later }); echo $menu->render($options);2 points
-
https://processwire.com/talk/topic/4680-block-access-to-settings-delete-and-view-tabs-for-page/2 points
-
Should be working again in the latest PW dev version: https://github.com/ryancramerdesign/ProcessWire/commit/52ac6b7a647c212afbc07446847743d21b862164 Thanks Ryan!2 points
-
You can't do this just out of the box but with a autoload module you could easily accomplish this. Also there's useful needed features in there for an editor. Why is this a problem? It may not necessary in most cases... In PW, almost all of these things can be changed modified using hooks on what builds them in the admin. So if you really want to do it, the best way would be through a module like the /site/modules/HelloWorld.module It shows some example of hooks and is worth a look and have a play anyway. This following module hides the InputfieldWrapper "Who can access this page"? in the settings tab for user having a role "editor". <?php class AdminHelperHooks extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'My Admin Helper Hooks', 'version' => 1, 'singular' => true, 'autoload' => true ); } public function init() { // add hook to the page edit module and the method that creates the wanted fieldset $this->addHookAfter('ProcessPageEdit::buildFormRoles', $this, "removeSettings"); } function removeSettings(HookEvent $event){ // check what role the user has, if not has editor role do nothing if(!wire("user")->hasRole("editor")) return; // $event->return being the inputfield wrapper $wrapper = $event->return; // set the inputfield wrapper to hidden $wrapper->collapsed = Inputfield::collapsedHidden; // we're done } } Create a new file AdminHelperHooks.module with this code in a new folder /site/modules/AdminHelperHooks/ Install and test with editor user.2 points
-
It's now working properly because you are providing to the $thumb variable the coverimage field without the url, and that's how it is supposed to be when you have to generate the thumb through the size method, otherwise it souldn't work. Edit: Think about it...to generate a thumbnail the size method has to know which image has to be resized (so its name, not the url...). Got it?1 point
-
There is a plugin, but I'm also aware that a new version of the forum software is out in the next few months. Couple that with the fact that Google can't see hidden forums (for commercial modules) and I'm not sure it's the best solution. Still, there is a plugin for the forums that's a whole $6 so I might look into that, but there's also a built-in integration with Sphinx search to look into that might be more suitable. Lots of options - I just need to find time to look at them. And then there's the possibility that some people still won't search but we can keep steering them gently in the right direction1 point
-
Recently the most popular answer in the forums is "Google it!" I can imagine community becoming less responsive if the moderators have to deal with more and more of those beginner level questions too often. So why not integrate google search into PW forum if it could help? I guess seing some more ads won't hurt nobody ))1 point
-
Apart from the "collateral releases" you've mentioned - not yet. Lately I was rewriting the template logic, but that refactoring is far from completed. Also, I'm currently putting emphasis on the tree view, but haven't found a js plugin yet that really fits my needs1 point
-
(This discussion is moved here from the GitHub issues board) The discussion ended by considering of moving the admin language files to a module (maybe even aware if the translations are for the regular version or the DEV version of ProcessWire). You comments and ideas are highly appreciated! --- DISCUSSION SUMMARY FROM GITHUB: tbba (ceberlin) wrote Today I had the honour to remove admin language translation files from the default language to have that back to English. That ment clicking the trashcan a 500 times while paying attention not to remove anything else but those admin language files. (Well I ended up doing this in the database directly as a workaround.) For the Wishlist: Why not adding a button where all instance that start with "wire--" have the trashcan seleced automatically. Or better: I would prefer at least to have them in a separate repeater list so that I find my own frontend translations and those settings by site--modules like supersmartypans easier. Or even better: why not separating Admin translation files to a module somehow so that installing/de-installiing, updating(via ModulesManager!) and switching them on and off is much easier? ryancramerdesign commented Double click the trash can and it'll mark them all for deletion. tbba (ceberlin) commented Thats cool. I did not know that. There is still the possibility of deleting too much (site-- stuff). What about the idea to separate the site-- files from the wire-- files? Wouldn't that be much easier? EDIT: And a module for the wire files would make the updates over the modules manager so easy. No more dropping of tons of files - and alerts when they are outdated. NicoKnoll commented I think it probably really makes more sense to change language packages to modules which are requiring "Language Support" to be installed. Pros: easy updatable makes my module "LanguageInstantInstall" obsolet because you just could list al of the languages which are in the module directory with "module manager" It's more the ProcessWire way of being modular Cons: How to add custom translations for e.g. modules?Maybe that's something for 2.6. tbba (ceberlin) commented A module would have another advantage: There could be something implemented that matches the translations to the PW version. Right now, using the DEV version could mean: not matching translations. But - thinking loud - there could be a DEV version of the language files on GIT that then matches with the PW DEV version - and the module selects the right one. ryancramerdesign commented I agree, language packs as modules would be nice for the future. Like Carl mentioned in splitting site and wire files, perhaps language pack modules would be for wire, and the existing storage system could be exclusively for site.1 point
-
Thanks for the right answer! The content of the array was just 'localhost'. I replaced it with my live domain name and now it works. However, I do not understand, why only the 'view' function was affected and but not 'edit', 'new' and move....1 point
-
Please double check HTTP Hosts Whitelist settings under site/config.php. /** * Installer: HTTP Hosts Whitelist * */ $config->httpHosts = array('example.com', 'www.example.com'); Thanks1 point
-
So Im a pretty big fan of the thumbnail generator. You can change image field to use it and then the field will act exactly the same except then you can talk to it like this. Just define that thumbnail is the resolution of the thumbnail that you want to use. Then if you want to be extra safe from the medling hands of your client add a class to your css: .medlingClient{ width:330px; height:158px; } <img class="medlingClient" src={$featured->images->first()->getThumb('thumbnail')} /> How's this look?1 point
-
Committed an little update and upped version to 1.3.3. - added support for PageArray as the third argument. So instead of the root page you give it an PageArray. https://github.com/somatonic/MarkupSimpleNavigation/blob/master/README.md#build-a-menu-using-a-pagearray-instead-of-a-single-root-page So you can do now something like this to build the top level menu entries, where "navigation_entries" would be a page field for selecting pages. $entries = $pages->get("/")->navigation_entries; echo $treeMenu->render(null, null, $entries); Or this would also be possible $menu = $modules->MarkupSimpleNavigation; // get a PageArray from a simple search $entries = $pages->find("template=basic-page"); $options = array("max_levels" => 1); echo $menu->render($options, null, $entries); @sparrow In your case you could now simply do use your "Top_Navigation" as the third argument. $menu = $modules->MarkupSimpleNavigation; $options = array("max_levels" => 1); echo $menu->render($options, null, $pages->get(1)->Top_Navigation);1 point
-
I have this working now with the three columns I want . I basically select the three pages from a page field on the homepage called "Featured_Content". Each of those pages has a title, image and summary. <div class="layer layer-is-featured"> <div class="row"> <?php foreach ($pages->get(1)->Featured_Content->find('limit=3') as $featured){echo " <div class='small-12 medium-4 columns'> <img src={$featured->images->first()->url} /> <h3 class='feature-heading'>{$featured->title}</h3> {$featured->summary} <a href='#'>Read more</a> </div> ";} ?> </div> </div> I'm wondering what the best way to crop each featured image to a specified dimension would be. If I ask my client to ensure each image is 330 x 158, she's going to mess this up. This looks like it might be my solution (http://modules.processwire.com/modules/fieldtype-crop-image/) but I'd rather specify in the code that each image should be cropped to 330 / 158. I have read through the ProcessWire image API docs (http://processwire.com/api/fieldtypes/images/) but I'm not sure how to combine this with my code above. foreach($page->images as $image) { $large = $image->width(500); $thumb = $image->size(100, 100); echo "<a href='$large->url'><img src='$thumb->url'></a>"; }1 point
-
Thanks Mike! I had forgotten that SiNNuT referred the grey background, and didn't take care of it. I added the !important and according to BrowserStack the problem seems to be solved! We added the strike-out to the active link after our first very professional usability test (with my sister ). We chose the strike-out after trying changing the color to green, but that didn't go well since in our system the color represents the links, and this link is deactivated. The strike-out besides being a very clear visual differentiation, also tells you that you can't press that link. --- I did some —well, a lot— optimisations on the website concerning speed. Would be great if you guys could tell me how the site feels like now, especially those on the other side of the ocean1 point
-
Disclaimer This is not a step by step tutorial, but the script posted serves as an example of how easy it is to bootstrap ProcessWire(PW), query an external API (in this case, Strava) and import stuff into PW pages using the PW API. To the import! So i wanted a quick, easy and automated way to import someones Strava activities into his/her own 'activity feed' on a certain PW website. Strava has an API which you can use to -amongst other things- get your own activity data. After setting up my Strava app i had access to the API. Next step was to import the JSON data i wanted into PW pages. This was as easy as creating a PW bootstrapped script (see code below) and using the PW API to import the data into Pages. For convenience in talking to the Strava API i used a library that is available on Github. To keep track of what was happening i decided it would be nice to log the import results to a log file. Luckily, PW had me covered by using the WireLog class (/wire/core/WireLog.php). Result With some googling on Strava and a (very) basic knowledge of PHP and the PW API i was able to get things working in no-time. With no other CMS i've worked with -and i've had dealings with quite a few- it would have been so easy to get the desired result. Some notes about the script: PW version used: 2.4.12, but should work in earlier versions as well. It does not create templates, fields and pages for you. If you would want to use it (maybe as a starting point), create templates, fields and pages for your own needs and adjust the script accordingly. Also remember to adjust script paths. In the posted example i don't do any sanitizing on the Strava data. You maybe should In production you would maybe call these kind of importers via a cronjob, and make it non-accessible from the outside. It served my purposes. There might be better ways of handling this stuff. All suggestions and/or questions are welcome. In this case the script was/is called importer_strava.php , located at mydomain/importer/importer_strava.php and requested manually. See notes above, number 3. <?php /** * Strava Importer * * This crude script will import your own Strava activities into newly created * PW pages under a given parent page. The import result will be logged in: * /site/assets/logs/importer_strava.txt, using the WireLog class. * * For this to work you first need to create an app via http://www.strava.com/developers * Strava API reference: http://strava.github.io/api/ * * The PHP library used for working with the Strava v3 API can be found at: * https://github.com/iamstuartwilson/strava * */ // Bootstrap Processwire include __DIR__ . '/../index.php'; // Include the PHP Library for working with the Strava v3 API include __DIR__ . '/StravaApi.php'; // Strava credentials (you can get these from the Strava app page you've created) $clientId = "Your clientId"; $clientSecret = "Your clientSecret"; $accessToken = "Your accessToken"; // Connect to Strava $api = new StravaApi( $clientId, $clientSecret ); // Set the parent where activities will be stored as child pages $activity_parent = wire('pages')->get("/activities/"); // Get new activities $results = $api->get( 'athlete/activities', $accessToken, array( 'after' => $activity_parent->strava_last_checked ) ); // Uncomment if you want to inspect the $results response onscreen // echo "<pre>"; // print_r($results); // echo "</pre>"; // Import new Strava activities to PW Pages if (empty($results)) { // Log that no activities have been imported $text = "No new activities have been imported"; $options = array('showUser' => false, 'showPage' => false); wire('log')->save('importer_strava', $text, $options); } else { $numImportedPages = 0; // Start counter for number of imported pages foreach ($results as $result) { $p = new Page(); // Create new page object $p->template = 'activity'; // Set template $p->parent = $activity_parent; // Set the parent // Assign $result data to the corresponding Page fields $p->name = $result->id; $p->title = $result->name; $p->act_distance = $result->distance; $p->act_moving_time = $result->moving_time; $p->act_elapsed_time = $result->elapsed_time; $p->act_total_elevation_gain = $result->total_elevation_gain; $p->act_type = $result->type; $p->act_start_date = substr($result->start_date_local, 0, 10); $p->act_average_speed = $result->average_speed; $p->act_start_lat = $result->start_latlng[0]; $p->act_start_long = $result->start_latlng[1]; $p->act_end_lat = $result->end_latlng[0]; $p->act_end_long = $result->end_latlng[1]; $map = $result->map; $p->act_map_polyline = $map->summary_polyline; $p->save(); // Save the Page object $numImportedPages++; // Increment counter } // Log the number of activities that have been imported $text = ($numImportedPages == 1) ? "$numImportedPages new activity imported" : "$numImportedPages new activities imported"; $options = array('showUser' => false, 'showPage' => false); wire('log')->save('importer_strava', $text, $options); // After the import, update Field 'strava_last_checked' to current Unix timestamp // This could also be placed outside of the 'else' to update on each script run $timestamp = $activity_parent; $timestamp->of(false); // Turn off output formatting before saving things $timestamp->strava_last_checked = time(); $timestamp->save('strava_last_checked'); }1 point
-
1 point
-
Ryan explains why here: https://processwire.com/talk/topic/3543-register-users-and-add-page-same-as-username/?p=351511 point
-
I have fixed the issue initially reported by @Raul and noted again by @lisandi. Attached is a working version. Please let me know if you still have any problems with it. FieldtypeTemplates.zip1 point
-
The users as actual pages. users | +-- admin | +-- bwaked | +-- martijn There's no way you could put a double bwaked in the above structure. (remember $users->get('bwaked') syntax, getting bwaked user from users PageArray ) If you want to create a new user front-end, you should first check if the user already exists by asking the id. if ($users->get('bwaked')->id) { // user already exists, if it didn't existed the returned id was 0 so bools to false } else { // there's no bwaked, goahead and create } If you create a new user that already exists and you want to save this user, ProcessWire prevents saving. (error)1 point
-
Hani, are you able to update this module listing to point to a GitHub repo of this project? With the module installation options in the PW modules menu, the current linked file (a .module file) doesn't work for automatic installation. While a GitHub repo is preferable, it may work if you can ZIP the module into an archive and post that instead. In either case, we need to update your module listing so that it points to GitHub and/or your module repo. Let me know if I can assist.1 point
-
Hi there, I just saw totoff's new doctor's site and thought, I add my dentist site here: http://zahnarztpraxis-wunschik.de/ Credits for design and concept go to http://www.gruenklee.de/grkl/ They did a great job on the design and photography. This is my first PW project where I learned my ways around. It is running on v2.3. I used the default site and married it with H5BP and added a sass framework for the styling part that I used in good old Joomla days. From the PW side of things, this wasn't a great challenge thanks to this great forum. I was very happy about the Gmaps field. Only had to tweak it a little to display the info bubble. And FormBuilder. Didn't want to spend too much time on the form coding in a new environment. Tricky part here was to get the datepicker to display in German. There are some Animation features. The three info boxes at the top are slidable. And there state (closed/open) is remebered across the site. That was tricky, too because I had never worked wit jQuery cookies before. Gave me some headache but finally worked out fine. There are also some image slideshow features in the header on the "Praxis&Philosophie" page and on the start page. I used cycle2 jQuery plugin which is absolutely great. And some slide-in effects on the team page. All in all I learned really a lot from setting this up. It gave me a good base to explore PW further and work on more challenging projects with even more Animations AJAX etc. that shall be presented here in the near future.1 point