Leaderboard
Popular Content
Showing content with the highest reputation on 07/17/2015 in all areas
-
You simply create a new template with a multilanguage text field for each expression you want to translate. the name of the fields and labels can be in english, but not necessarily the words that you will output, they would be just informative. Then you fill the fields with all the languages. To output them in other templates, you would do this: // top of the file $translations = $pages->get('/translations/'); // and when needed echo $translations->more_articles; // inside functions echo wire('pages')->get('/translations/')->more_articles;2 points
-
Hi, maybe I'm doing something wrong. I selected an image field in module settings which is assigned to the user system template. But no avatar image appears. Looking into the code it turns out that in AdminThemeRenoHelpers.php line 81 the property avatar_field has to be renamed to avatar_field_user. After changing that line the image appears. ProcessWire 2.6.8 dev. Table modules column data looks like this: {"colors":"kfi-robot","avatar_field_user":"blog_images","userFields_user":"name",...} (changing the name of the input field should fix this as well). + $adminTheme->avatar_field_user != '' ? $imgField = $user->get($adminTheme->avatar_field_user) : $imgField = ''; - $adminTheme->avatar_field != '' ? $imgField = $user->get($adminTheme->avatar_field) : $imgField = '';2 points
-
you mean like this? <?php $relatedProjects = $pages->find("template=project,limit=2"); foreach($relatedProjects as $rp) { echo "<h2>{$rp->title}</h2>"; echo '<img src="' . $rp->images->first()->url . '" alt='' />'; }2 points
-
This exact search could be simply: $pages->find("parent=/landscape_stone/natural/flagstone/, color=brown|gray, size=medium")2 points
-
Yes. Scenario 1: Let's say you want to show a field on all pages that are the child of a certain page. In the visibility settings put: parent_id=id-of-parent-page-here Scenario 2: Let's say you want to show a field on a specific page. In the visibility settings put: id=id-of-page-here2 points
-
Some time ago I developed a module (FieldtypeImageExtra) which extends Fieldtype Image with the ability to add custom fields to an image. This worked well but it had a somehow restricted applicability and did not meet all of our needs. There of course are other useful image modules like CroppableImage or ImageFocusArea, but up to now there was no possibility to combine image cropping with custom fields support. So you had to decide whether to add image cropping or the possibility to add custom fields because each of those modules sets up their own field type (and input type) which cannot be combined. The new module ImageExtra allows you to have both functionalities. You can get the module from GitHub. For more informations have a look at this blog post. If you notice any problems or unexpected behaviour please let me know.1 point
-
1 point
-
1 point
-
1 point
-
Always been a fan of mod_rewrite, and so I never use Redirect or RedirectMatch. You'll be better off doing a simple RewriteRule just below RewriteEngine On. RewriteRule ^old.html$ /new-location/ [END,R=301]1 point
-
1 point
-
1 point
-
Why not iterate over them? If you need to check for all of them then it's the smartest way to do so. $data-color = ""; $colorMap = array( 1025 => '#ffff00', 1029 => '#6d8d24' ); forach($colorMap as $id => $color) { if($project->project_tags->has($id)) $data-color .= $color; } // $data-color now consists of all the colors, where a tag was found.1 point
-
if this is what you get "1025|1074|1026|1027" then you need to do an explode with a delimiter, which turns them into an array then you can check with the in_array function1 point
-
$parts = array( "Movies" => "movie", "Directors" => "directors" ); foreach($parts as $title => $template){ $results = $pages->find("template=$template, …"); echo "<h2>$title</h2>"; echo "<ul>"; foreach($results as $result){ echo "<li>$result->title</li>"; } echo "</ul>"; }1 point
-
I'm currently building small Page Label enhancement. Can you tell?1 point
-
I rebuilt my brothers website from it's WordPress theme/plugin into a ProcessWire designed theme. Mostly because it was build poorly, half the things didn't work and it kept getting attacked through 3rd party plugins, and not knowing much about WordPress other that omg I hate it - decided to look else where! Turned out nice I thought, easily modifiable pages/projects with tagging showcase etc, and using FormBuilder with bootstrap theme for contact form, also ProCache. Will look to try use ProcessWire for further projects, very nice to use as a dev. Cheers John1 point
-
That's quite a specific need, I doubt that you'll find this ready-made. So either just use multiple mapmarker fields or multiple pages, or you'd most likely need to enhance the module by yourself so to store multiple values. If you go the latter route, than have a look at FieldtypeEvent. It shows quite nicely how one can make a fieldtype multivalue from an existing single value.1 point
-
What I do is use $config->js to populate the config array that I then output in the head for dynamic variables that want to share in a script. $config->js("myconfig", array("myajaxurl" => $pages->get(1991)->url); You can do this in templates or modules doesn't matter as long as it's before rendering page. Then this little to output as json. This is the same as PW uses in the admin to share config vars with js. <script type="text/javascript"> <?php // output javascript config json string to html // for use in javascripts from this point on $jsConfig = $config->js(); $jsConfig['debug'] = $config->debug; $jsConfig['urls'] = array( 'current_url' => $page->url, 'root' => $config->urls->root, ); ?> var config = <?php echo json_encode($jsConfig); ?>; </script> Then use in your script as var rootUrl = config.urls.root; for example1 point
-
I'm not exactly sure what you're thinking "combine" means here, but this field does exactly what the description says; it grabs data from other fields, mashes it all together into one big blob of (JSON) content -- and that's just about it. One very simple (yet sometimes very practical) use case is if you've got, say, 15 different text fields and you need to find pages that contain value "john doe" in any of those. Instead of doing this: $john_does = $pages->find('field1|field2|field3|field4|field5|...|field15%="john doe"'); .. you can create a cache field, select all of those fields to be cached in it, and then do this: $john_does = $pages->find('my_cache_field%="john doe"'); Not only does this look clean, in certain situations it can wildly improve query performance.1 point
-
I came back to this thread because of this other one http://processwire.c...portfolio-site/. As I remember, the need of adding extra information to the images and files fields was already mentioned some times. Ryan, are you still planning to extend the core fields with this? It would be actually a great feature to do this in the field config options!!1 point