Jump to content

rafaoski

Members
  • Content Count

    74
  • Joined

  • Last visited

  • Days Won

    2

rafaoski last won the day on March 9 2018

rafaoski had the most liked content!

Community Reputation

133 Excellent

About rafaoski

  • Rank
    Full Member

Recent Profile Visitors

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

  1. 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');
  2. 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
  3. 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://proc-profiles.tk/uk3-min/ ... Now it should be better 🙂
  4. 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://proc-profiles.tk/uk3-min/ 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:
  5. 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 ...
  6. 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:
  7. Thanks for the answer ... It seems that the LastPass plugin generate error ... After turning off the add-on LastPass everything has returned to normal ...
  8. 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
  9. 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>
  10. 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;?>
  11. You can try this Site Profile Milligram Photoswipe which I've added a simple photoswipe gallery ...
  12. 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:
  13. 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 🙂
  14. 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/
  15. Thanks to Adrian, everything has become clear now 🙂
×
×
  • Create New...