• Content Count

  • Joined

  • Last visited

  • Days Won


rafaoski last won the day on March 9 2018

rafaoski had the most liked content!

Community Reputation

110 Excellent

About rafaoski

  • Rank
    Full Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. rafaoski

    Maybe try using two foreach loops: <?php foreach ($pages->get('/portal/movies/')->children as $movieCategory) { echo "<h3><a href='$movieCategory->url'>$movieCategory->title</a></h3>"; echo '<ul>'; // Get movie Children foreach ($movieCategory->children as $movie ) { echo "<li><a href='$movie->url'> $movie->title </a></li>"; } echo '<ul>'; } ?> Or using $pages->find() ... Show children from the template, which is assigned to a single movie: <ul><?php // https://processwire.com/api/ref/pages/find/ $items = $pages->find("template=single-movie, limit=12"); // Loop foreach ($items as $item) { echo "<li><a href='$item->url'>$item->title</a></li>"; } ?></ul> <?php // Pagination https://processwire.com/api/modules/markup-pager-nav/ $pagination = $items->renderPager(); echo $pagination;?>
  2. You can try this Site Profile Milligram Photoswipe which I've added a simple photoswipe gallery ...
  3. If you want the customer to easily update the fields you can create a translate and translate_string templates. You will be able to easily create translations using pages ... Next, create function inside the _translate file to show translateable field title as in the movie, for example: <?php namespace ProcessWire; function trStr($page, $str) { $tr_page = pages()->get("/translate/$page/")->title; if($tr_page) { return $tr_page; } else { return $str; } } // Translate Strings page()->ts = [ 'your_awesome_string' => trStr('your-awesome-string', __('Your Awesome Strings')), ]; And display on the site: <h1><?=page()->ts['your_awesome_string']?></h1> You can download this profile from here:
  4. Hi ... Here you should find a lot about the translations https://processwire.com/api/multi-language-support/code-i18n/ I do not know if this is the best solution, but it works for me ... Thanks to this, I do not have to search for translations in all of the template's peaks ... So I create a simple file responsible for all translations _translate.php Include this file inside _init.php include_once('./_func.php'); include_once('./_translate.php'); And define in the table as below <?php namespace ProcessWire; // Translate Strings page()->ts = [ // Language => locale / code prefx 'locale' => _x('en_US', 'HTML locale code'), 'lang_code' => _x('en', 'HTML language code'), // Main Page ( main.php ) 'site_name' => __('Your Site Name'), 'logo_alt' => __('Show My Awesome Logo'), // Archives Page 's_archives' => __('Select The Archives'), 'date' => __('Date'), ]; Then you can call globally using page() <h1><?=page()->ts['site_name'];?></h1> And there is a pro option Functional Fields: https://processwire.com/blog/posts/functional-fields/ But I can not say too much about it because I have not tested it but it looks interesting
  5. rafaoski

    Hi and welcome ... You can add your own field in a very simple way ... See also here https://processwire.com/api/variables/page/ You have to go to the template that the page uses and add a few lines of php code as below ... <?php echo page()->custom_field?> <?php echo $page->custom_field?> <?php echo page('custom_field')?> See this short video in which I used the regular UIKIT 3 profile which is in the Processwire DEV version You can display this field in the _main.php file in the same way, or if for example, you create an option page, you can use this way in which the field will be visible on all pages https://processwire.com/api/variables/pages/ ... <h1>Home Page Field ( / ) <?= pages('/')->custom_field ?></h1> <h1>Home Page Field ( / ) <?= pages()->get('/')->custom_field ?></h1> <h1>About Page Field ( /about/ ) <?= pages('/about/')->headline ?></h1> <h1>About Page Field ( /about/ ) <?= pages()->get('/about/')->headline ?></h1> This old tutorial is also good to starting learn Processwire : https://processwire.com/docs/tutorials/hello-worlds/
  6. rafaoski

    Thanks to Adrian, everything has become clear now
  7. Hi everyone ... Generally, this is about the new mailHTML() function that does not work correctly on processwire 3.0.110 https://github.com/processwire/processwire/blob/dev/wire/core/WireMailTools.php#L291 https://processwire.com/api/ref/mail/mail-h-t-m-l/ I do not know if I'm making a mistake trying to send an e-mail or if it's a bug in the core This is my code: <?php // $m = $mail->new(); // option A // $m = new WireMail(); // option B $m = wireMail(); // option C $m->mailHTML('alex@gmail.com', 'Hello', '<html><body><h1>Message Body</h1></body></html>'); $m->send(); ?> Details from Tracy Debugger SERVER DETAILS ProcessWire: 3.0.110 PHP: 7.2.8 Webserver: Apache/2.4.34 (Unix) MySQL: 10.1.34-MariaDB SERVER SETTINGS allow_url_fopen: 1 max_execution_time: 120 (changeable) max_input_nesting_level: 64 max_input_time: 60 max_input_vars: 1000 memory_limit: 256M post_max_size: 8M upload_max_filesize: 20M xdebug: xdebug.max_nesting_level: mod_rewrite: 1 mod_security: *confirmed off GD: 2.2.5 GIF: 1 JPG: 1 PNG: 1 EXIF Support: FreeType: 1 Imagick Extension: MODULE DETAILS TracyDebugger: 4.11.13
  8. Thanks to @dragan ... It looks like it's okay now after adding the margin auto to the grid /* eliminate horizontal scrollbars */ .grid { margin-right: auto; margin-left: auto; }
  9. Thanks to @Pixrael ... I have already added this profile, but as usual, it will take some time before the profile is approved I think that in a few hours the profile should be in the module catalog
  10. This profile can be used as a business card or very simple blog. Requires the latest version processwire 3.0.101 !!! Milligram Site Profile For Processwire 3x with include functions like: MarkupRegions FunctionsAPI wireIncludeFile | wireRenderFile Essentially, this structure uses minimalist CSS framework Milligram and the Flexbox Grid System Gridlex Live Example CAN DOWNLOAD FROM THIS LINK ( Basic Version and simple Blog Version ) https://github.com/rafaoski/site-milligram https://github.com/rafaoski/site-milligram-blog Screenshot: If you want to use Laravel Mix you must first ensure that Node.js and NPM are installed on your machine. Basic example to Debian and Ubuntu based Linux distributions: Node.js curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - sudo apt-get install -y nodejs See more installation options LINK npm is installed with Node.js just check in linux terminal like below: node -v npm -v Set BrowserSync inside folder /templates/webpack.mix.js and change your dev url proxy: 'http://localhost/mix/', to your installation processwire folder like: proxy: 'http://localhost/your-processwire-installation-folder/', Next install npm packages in your templates folder with command npm install Now, boot up the dev server npm run watch, and you're all set go! On completion, use the command npm run production to build styles and scripts in the dist folder Simple Usage ( Basic Command ) Run npm install Watch npm run watch Build npm run production All files to Webpack build steps is inside file ( webpack.mix.js ) Folder With all SCSS files is inside templates/src/scss All build styles and scripts is inside the ( dist ) folder References: Milligram Gridlex Laravel Mix Feather Icons Web Font Loader Verlok Lazy Load Cookie Consent Particles.js
  11. I was wondering if it would be better to change the name of the page after publishing ... wire()->addHookBefore('Pages::publishReady', function($event) { $page = $event->arguments('page'); if ($page->template->name == 'news-article') { $page->name = $page->title . '-myslug'; } });
  12. rafaoski

    @matjazp You can try pages.id==1234 It seems to me that in the settings the search appliance looks for similar expressions instead of identical ones which you change with the operator's ( == )
  13. rafaoski

    In your example @JoelB95, just use pw-before ... <div pw-before="page-content"> <h1><?= 'BEFORE #page-content' ?></h1> </div> <div id="page-content"> <h1><?=$page->title?></h1> Overview page </div> <div pw-after="page-content"> <h1><?= 'AFTER #page-content' ?></h1> </div>
  14. I tested your version on the latest issue of Processwire 3.0.95 with a defolt Profile (site-beginner) and it works if I add into $pages->find() selector => images.count>0 Now he should search only if the field has images images.count>0 _func.php function test($selectTemplate) { $pages = wire('pages'); $children = $pages->find("parent.template={$selectTemplate}, include=all, limit=3, images.count>0"); $out = ''; foreach($children as $child) { $image = $child->images->first; $out .= '<img src="'.$image->width(50)->url.'">'; } return $out; } basic-page.php <?=test('basic-page'); ?>
  15. Thanks to you and ( @kongondo' , @Pete , @justb3a ) for a great blog profile which is a good alternative to wordpress ... I noticed a very small error in ready.php, the translation function lacks ... Error: Uncaught Error: Call to undefined function _() in /srv/http/proc-blog/site/ready.php:12 "nextItemLabel" => _("Next Page &gt;"), "previousItemLabel" => _("&lt; Previous Page"), "nextItemLabel" => _("Next Page &gt;"), "previousItemLabel" => _("&lt; Previous Page"), Just add double underlining to translations __() Yeah, thanks a great profile for once.