Jump to content

rafaoski

Members
  • Content Count

    77
  • Joined

  • Last visited

  • Days Won

    2

rafaoski last won the day on March 9 2018

rafaoski had the most liked content!

Community Reputation

135 Excellent

About rafaoski

  • Rank
    Full Member

Recent Profile Visitors

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

  1. Thank @JheymanMejia for the comment and I am sorry that I reply so late, but now I have a lot of work at home (renovation of the apartment). If you still need this option, I've added a simple reply button for comments and basic navigation for them. https://github.com/rafaoski/site-uk3-minimal/commit/bf4b437319f804a0bfcb1ef9000dad056d2a1cb6 If you want more or less nesting, you must set "Reply depth" in the setting comments field ( this will add a reply button ) Below is the code for the Regular blog site profile that should work: 1. Replace the selected functions in the file _uikit.php: https://github.com/processwire/processwire/blob/7d4ca45673152436ea492b6577341ee3550e2821/site-regular/templates/_uikit.php#L898-L1040 To this code: /***************************************************************************************** * ProcessWire/Uikit functions for rendering comments and comment forms * * Note: comment threads (depth), stars and votes are not yet supported in here. * */ /** * Render a comment repply * * @param int $commentId get comment id to add reply button * */ function commentReply($commentId) { return "<a class='CommentActionReply uk-button uk-button-text' data-comment-id='$commentId' href='#Comment$commentId'>Reply</a>"; } /** * Render a ProcessWire comment using Uikit markup * * @param Comment $comment * @param int $calculateDepth calculate comment depth * @return string * */ function ukComment(Comment $comment, $calculateDepth) { $text = $comment->getFormatted('text'); $cite = $comment->getFormatted('cite'); $website = $comment->getFormatted('website'); $field = $comment->getField(); $page = $comment->getPage(); $classes = array(); $metas = array(); $gravatar = ''; // Set reply button $maxDepth = $comment->getField()->depth; // Max depth from field comments $replies = $calculateDepth <= $maxDepth ? commentReply($comment->id) : ''; if($field->get('useGravatar')) { $img = $comment->gravatar($field->get('useGravatar'), $field->get('useGravatarImageset')); if($img) $gravatar = "<div class='uk-width-auto'><img class='uk-comment-avatar' src='$img' alt='$cite'></div>"; } if($website) $cite = "<a href='$website' rel='nofollow' target='_blank'>$cite</a>"; $created = wireDate('relative', $comment->created); if($field->get('usePermalink')) { $permalink = $page->httpUrl; $urlSegmentStr = $this->wire('input')->urlSegmentStr; if($urlSegmentStr) $permalink .= rtrim($permalink, '/') . $urlSegmentStr . '/'; $permalink .= '#Comment' . $comment->id; $permalink = "<a href='$permalink'>" . __('Permalink') . "</a>"; $metas[] = "<li>$permalink</li>"; } $classes = implode(' ', $classes); $metas = implode('', $metas); $out = " <article id='Comment$comment->id' class='$classes uk-comment uk-comment-primary' data-comment='$comment->id'> <header class='uk-comment-header uk-grid-medium uk-flex-middle' uk-grid> $gravatar <div class='uk-width-expand'> <h4 class='uk-comment-title uk-margin-remove'>$cite</h4> <ul class='uk-comment-meta uk-subnav uk-subnav-divider uk-margin-remove-top'> <li>$created</li> $metas </ul> </div> </header> <div class='uk-comment-body'> $text </div> $replies </article> "; return $out; } /** * Render a list of ProcessWire comments using Uikit markup * * Note: does not currently support threaded comments (comment depth). * Use ProcessWire’s built-in comments rendering for that purpose. * * @param CommentArray $comments * @param array|string $options Options to modify default behavior * - `id` (string): HTML id attribute of the comments list (default='comments'). * @param int $calculateDepth calculate comment depth * @return string * */ function ukComments(CommentArray $comments, $options = array(), $calculateDepth = 0) { $out = ''; $calculateDepth++; $defaults = array( 'id' => 'comments', 'ul' => true ); if(!count($comments)) return ''; $options = _ukMergeOptions($defaults, $options); if($options['ul']) $out .= "<ul id='$options[id]' class='uk-comment-list'>"; foreach($comments as $comment) { $out .= "<li class='uk-margin-small'>"; $out .= ukComment($comment, $calculateDepth); // check comment children if($comment->children) { $out .= "<ul class='uk-nav-sub uk-margin-remove'>"; $out .= ukComments($comment->children, ['ul' => false], $calculateDepth); $out .= '</ul>'; } $out .= "</li>"; } if($options['ul']) $out .= "</ul>"; return $out; } /** * Render a comment posting form * * @param CommentArray $comments * @param array $options See `CommentForm` class for all options. * @return string * */ function ukCommentForm(CommentArray $comments, array $options = array()) { $defaults = array( 'headline' => "", 'successMessage' => __('Thank you, your comment has been posted.'), 'pendingMessage' => __('Your comment has been submitted and will appear once approved by the moderator.'), 'errorMessage' => __('Your comment was not saved due to one or more errors.') . ' ' . __('Please check that you have completed all fields before submitting again.'), ); $options = _ukMergeOptions($defaults, $options); $options['successMessage'] = ukAlertSuccess($options['successMessage'], 'check'); $options['pendingMessage'] = ukAlertSuccess($options['pendingMessage'], 'check'); $options['errorMessage'] = ukAlertDanger($options['errorMessage'], 'warning'); if(!isset($options['attrs']) || !isset($options['attrs']['class'])) { $options['attrs'] = array('class' => 'uk-comment uk-comment-primary'); } $adjustments = array( "<input type='text'" => "<input type='text' class='uk-input'", "<input type='email'" => "<input type='email' class='uk-input'", "<p class='CommentForm" => "<p class='uk-margin-remove-top CommentForm", "<textarea " => "<textarea class='uk-textarea' ", "<button " => "<button class='uk-button uk-button-primary' ", "<label " => "<label class='uk-form-label' ", ); $out = $comments->renderForm($options); $out = str_replace(array_keys($adjustments), array_values($adjustments), $out); return $out; } 2. Change lines from 14 to 25 inside blog-post.php: https://github.com/processwire/processwire/blob/7d4ca45673152436ea492b6577341ee3550e2821/site-regular/templates/blog-post.php#L14-L25 To this code: // https://processwire.com/talk/topic/594-how-can-i-use-pagination-with-comments/ $limit = 12; $start = ($input->pageNum - 1) * $limit; // Find comments that don't have a parent ( parent_id=0 ) $comments = page()->comments->find("start=$start, limit=$limit, parent_id=0"); // comment list if(count($comments)) { echo ukHeading3("Comments", "icon=comments"); echo ukComments($comments); if($input->pageNum > 1) { echo "<a class='uk-button uk-button-text' href='./page" . (input()->pageNum - 1) . "'>" . ukIcon('arrow-left') . __('Previous Comments') . "</a> "; } // Find comments that don't have a parent ( parent_id=0 ) if($start + $limit < count(page()->comments->find("parent_id=0"))) { echo "<a class='uk-button uk-button-text' href='./page" . (input()->pageNum + 1) . "'>" . __('Next Comments') . ukIcon('arrow-right') . "</a>"; } } // comment form echo ukHeading3("Post a comment", "icon=comment"); echo ukCommentForm(page()->comments); Remember to set the Reply depth inside comments field: And adding options for page nubmers in the setting blog-post template:
  2. Hi and thanks @MateThemes ... The _init.php file is responsible for most profile settings ... You can change the setting blog comments options on this line: https://github.com/rafaoski/site-uk3-minimal/blob/9ea54af1f144fbb9642baee67adb604be0f4b1ea/templates/_init.php#L33 'comments' => true, // Blog Comments Just change to false: 'comments' => false, // Blog Comments This setting should disable comments in the files: templates/views/blog/blog-post.php ( https://github.com/rafaoski/site-uk3-minimal/blob/9ea54af1f144fbb9642baee67adb604be0f4b1ea/templates/views/blog/blog-post.php#L39 ) templates/views/blog/parts/_blog-article.php ( https://github.com/rafaoski/site-uk3-minimal/blob/9ea54af1f144fbb9642baee67adb604be0f4b1ea/templates/views/blog/parts/_blog-article.php#L59 ) You will learn more about the new functions API setting() from this place: https://processwire.com/blog/posts/processwire-3.0.119-and-new-site-updates/#new-functions-api-setting-function
  3. I have just changed the link to the page demo view ...
  4. The easiest way is to set the options page in the _init.php file: $siteOptions = $pages->get('/options/'); // If you set setFunctionsAPI ( $config->useFunctionsAPI = true; ) to true in the configuration file, you can display them in the template in this way $siteOptions = pages()->get('/options/'); //or $siteOptions = pages('/options/'); Then in the template just display the fields: <h1><?= $siteOptions->site_name ?></h1> <?php // In the field settings you should select to display a single image if ($siteOptions->logo): ?> <img src="<?= $siteOptions->logo->url ?>" width='100' alt="<?= $siteOptions->logo->description ?>"> <?php endif ?> Or add new “Unique” status for pages https://processwire.com/blog/posts/pw-3.0.127/ Add this status to the Options page and in the _init.php file get this way: $siteOptions = pages()->get('options'); // or $siteOptions = pages('options');
  5. Hi ... Jonathan Lahijani has a great tutorial on youtube that can help you Simply put, you need to create an option template, then add 2 pages, one in the page tree named options, to which you choose the option template, and under the admin add another page and change the name, for example (admin_options), so that the names are not identical. Choose a process named ProcessPageEdit and save the page ... in admin.php paste the code // Custom Options Page if( page()->name == 'admin_options' ) input()->get->id = pages()->get('options')->id; Finally, you can add some css to hide the options page in the page tree. /** Hook Admin Custom CSS */ $wire->addHookAfter('Page::render', function($event) { if(page()->template != 'admin') return; // Check if is Admin Panel $value = $event->return; // Return Content $templates = urls()->templates; // Get Template folder URL $style = "<link rel='stylesheet' href='{$templates}assets/css/admin.css'>"; // Add Style inside bottom head $event->return = str_replace("</head>", "\n\t$style</head>", $value); // Return All Changes }); You can also download the profile that has the option page created and see how you can create your own options page https://github.com/rafaoski/site-minimal
  6. Thanks for info @dragan ... This is just the test domain that I got along with the hosting ... Apparently something is wrong with her ... I've added a profile to a different domain https://uk3-min.templatek.pl/ ... Now it should be better 🙂
  7. This is a profile based on the Uikit3 framework and features from the regular site profile. Requires the latest version processwire 3.0.127 Download from this link: https://github.com/rafaoski/site-uk3-minimal Live Example: https://uk3-min.templatek.pl/ Basic Info: Most of the profile settings and translates are in the _init.php file. Functions can be found in the _func.php, _uikit.php file. The entire view is rendered in the _main.php file that uses markup regions. You can easily add hooks using the ready.php file. Options page added with the new “Unique” status, which you can use in this simple way like: pages('options')->site_name pages->get('options')->site_name The Author's website's blog entries use URL segments (/ authors / {author-name} /), see views/blog/blog.php for more info. This profile has additional functions (_uikit.php) from the regular uikit3 profile, which is located in the basic ProcessWire installer ( there are minor changes, such as adding translations from _init.php ) Screnshoots:
  8. Thanks ... I am also of the opinion that it is great to have a good basis for further development of the profile that contains the latest additions API ... I think that this profile should be quite simple for users, given that all the latest features are described on the blog ... Anyway, it's nice that it comes in handy ...
  9. This profile can be used as a simple business card or it can be used as a starting profile. Live Example Can download from this link: https://github.com/rafaoski/site-minimal Basic Info Most of the profile settings and translates are in the _init.php file. Functions can be found in the _func.php file. The entire view is rendered in the _main.php file that uses markup regions. You can easily add hooks using the ready.php file. Options page added with the new “Unique” status, which you can use in this simple way like: pages('options')->site_name pages->get('options')->site_name Screenshots:
  10. Thanks for the answer ... It seems that the LastPass plugin generate error ... After turning off the add-on LastPass everything has returned to normal ...
  11. Hi, @tpr and thanks you for adding this useful module. After switching on AdminOnSteroids I noticed a small problem appearing when opening and closing the repeater, but only in Mozilla Firefox and Admi Theme Uikit. After opening the single repeater, it remains in the open position. I'm not fluent in JS and I do not know where the error is, but the console shows me information as below. Error: Permission denied to access property "apply" SERVER DETAILS ProcessWire: 3.0.126 PHP: 7.3.1 Webserver: Apache/2.4.35 (Win64) OpenSSL/1.1.1a MySQL: 5.7.24 MODULE DETAILS AdminOnSteroids: 2.0.13 ProcessTracyAdminer: 1.0.6 TracyDebugger: 4.17.22
  12. I think it is best to add a photo to the head element as below: ( I've added a simple if statement that will check in which template to display the pictures ) <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title><?php echo $page->title; ?></title> <meta name="description" content="<?php echo $page->summary; ?>" /> <link href='//fonts.googleapis.com/css?family=Lusitana:400,700|Quattrocento:400,700' rel='stylesheet' type='text/css' /> <link rel="stylesheet" type="text/css" href="<?php echo $config->urls->templates?>styles/main.css" /> <?php // Get Images ( https://processwire.com/docs/fields/images/ ) $image = $page->images; // Show only in these templates $check_templates = ['home', 'basic-page']; if ( in_array($page->template->name, $check_templates) ): ?> <style> /* https://css-tricks.com/perfect-full-page-background-image/ */ body { /* background: url(<?php // if($image) echo $image->first()->url;?>) no-repeat center center fixed; */ background: linear-gradient( rgba(0, 0, 0, 0.91), rgba(2, 35, 50, 0.82) ), url("<?php if($image) echo $image->first()->url;?>") no-repeat center center fixed; background-size: cover; height: 100%; } p, h1, h2, h3 { color: aliceblue; } a { color: tomato; } .summary { color: aliceblue; } </style> <?php endif; ?> </head> <body> <main id='main'> Remember to download images correctly if you use the images field, for example: https://processwire.com/docs/fields/images/ <?php $image = $page->images; if($image) echo $image->first()->url; ?> You can also check the selected page where you want to display the picture: <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title><?php echo $page->title; ?></title> <meta name="description" content="<?php echo $page->summary; ?>" /> <link href='//fonts.googleapis.com/css?family=Lusitana:400,700|Quattrocento:400,700' rel='stylesheet' type='text/css' /> <link rel="stylesheet" type="text/css" href="<?php echo $config->urls->templates?>styles/main.css" /> <?php // Get Images ( https://processwire.com/docs/fields/images/ ) $image = $page->images; // Show only in these pages $check_page_name = ['home', 'about']; if ( in_array($page->name, $check_page_name) ): ?> <style> /* https://css-tricks.com/perfect-full-page-background-image/ */ body { /* background: url(<?php // if($image) echo $image->first()->url;?>) no-repeat center center fixed; */ background: linear-gradient( rgba(0, 0, 0, 0.91), rgba(2, 35, 50, 0.82) ), url("<?php if($image) echo $image->first()->url;?>") no-repeat center center fixed; background-size: cover; height: 100%; } p, h1, h2, h3 { color: aliceblue; } a { color: tomato; } .summary { color: aliceblue; } </style> <?php endif; ?> </head> <body> <main id='main'> If you use a REGULAR profile wchich using new template file strategy, it's very simple to add styles in the selected template like home <?php namespace ProcessWire; /* home.php */ // get most recent blog post $blog = pages()->get('/blog/'); $blogPost = $blog->child(); // Get Images ( https://processwire.com/docs/fields/images/ ) $image = $page->images; ?> <head id='html-head' pw-append> <style> /* https://css-tricks.com/perfect-full-page-background-image/ */ body { /* background: url(<?php // if($image) echo $image->first()->url;?>) no-repeat center center fixed; */ background: linear-gradient( rgba(0, 0, 0, 0.91), rgba(2, 35, 50, 0.82) ), url("<?php if($image) echo $image->first()->url;?>") no-repeat center center fixed; background-size: cover; height: 100%; } p, h1, h2, h3 { color: aliceblue; } a { color: tomato; } .summary { color: aliceblue; } .uk-card h3 { color: black; } .uk-card p { color: black; } </style> </head> <h1 id='content-head'> <?=page()->headline?> </h1> <div class='uk-margin-top' id='content-body'> <?=page()->body?> <hr> <p class='uk-margin-small'> <a class='uk-button uk-button-link uk-link-muted' href='<?=$blog->url?>'> In the blog </a> </p> <?=ukBlogPost($blogPost)?> <p class='uk-margin-small'> <a href='<?=$blog->url?>'>More blog posts <?=ukIcon('arrow-right')?></a> </p> </div> <aside id='sidebar'> <?=ukNav(pages()->get('/categories/')->children)?> <div class='uk-card uk-card-default uk-card-hover uk-card-body uk-margin-medium-top'> <?=page()->sidebar?> </div> </aside>
  13. 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;?>
  14. You can try this Site Profile Milligram Photoswipe which I've added a simple photoswipe gallery ...
  15. 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:
×
×
  • Create New...