Jump to content

Recommended Posts

@Raymond - if that's what happens then it is working correctly :-). Blog does not automatically associate permissions and roles. That would be assuming too much. It is left to you to set up. To help you, it creates the role 'blog-author' and a permission 'blog'. The role 'blog-author' is used to find and list, uh, Blog Authors' posts. The permission 'blog' is used to grant view access to the Blog Dashboard.

So, as per normal PW access control setup, you will need to assign roles/permissions to your users at both the access and template level. You can still create additional permissions/roles to fine tune who can post, publish, edit, posts, etc. So, if you want your user to view the dashboard you can add the permission 'blog' to the role 'blog-author' (or any other role you create) and give your user that role. If you want them to access the Blog pages tree, you can do that at the template level. E.g. create a role 'blog-editor', and use that to control template-level permissions for Blog pages (view, edit, delete, etc). You can take advantage of PW's cascading permissions feature (i.e. children inherit parents').

Please note that if you do not want users to be able to delete Blog posts at the template level then you should also not give them access to the Blog Dashboard since they will be able to delete posts anyway. I have not had the need to add such an access control at the Blog Dashboard level beyond checking if they have 'view permission' ('blog') and for the 'Cleanup' utility, that they are supersusers.

  • Like 1

Share this post


Link to post
Share on other sites

Hi Kogondo,

Thanks for the quick reply. Adding the permission 'blog' to the role 'blog-author' look likes its sufficient for my needs. (havent tested it all yet)

Now i only need to do is redirect a logged in user with blog-author role to the blog page after loggin in.

Share this post


Link to post
Share on other sites

Hi,

I would like to add some of my standard fields to the blog templates. These trigger support for generating microdata and so on. Are there any obvious reasons not to do this? Any advice much appreciated!

Cheers.

Share this post


Link to post
Share on other sites

@Gazley. None whatsoever from the point of view of upgrading Blog. Upgrades don't overwrite anything outside /site/modules/ProcessBlog/. Nothing is reinstalled, your content, fields, etc are not affected. You could even rename your Blog pages and it will still work fine. Only two don't dos: don't change the IDs of the main Blog pages in the db and don't rename Blog fields and templates :-)

Share this post


Link to post
Share on other sites

Hi Kongondo,

Thanks for the heads-up! :) That's great to hear - now I can add my little standard "bits and pieces" and all will be well in my world :)

Getting along great with the Blog;  thanks once again for providing such an awesome module!

Cheers.

Share this post


Link to post
Share on other sites

I need to ask a question i need to reformat the content but i don't want to modify the core because when there's an update it would be overwritten and that's bad practice what are my options. I want to be in control of the template without having to hack it. 

Share this post


Link to post
Share on other sites

@Sephiroth, you are in control of the template (files)  :-). Could your question be a bit more specific? If you are referring to the optional demo content - those are just that; demos...

Share this post


Link to post
Share on other sites

@Sephiroth, you are in control of the template (files)  :-). Could your question be a bit more specific? If you are referring to the optional demo content - those are just that; demos...

I might jump in here too and ask the same thing. Hopefully we're asking the same question.

Currently, my /blog/posts/ page lists all my posts in the structure as follows

  • Post Title
  • Posted by Author Name. Date and Time
  • Post summary with ellipses at approx 50 words

If we want to change this to add the contents of a field such as

  • Post Title
  • Post_Summary field
  • Posted by Author Name. Date and Time
  • Post summary with ellipses at approx 50 words

would we need to edit the file called MarkupBlog.module ?

And if so, how is that not overwritten when we perform an update to the Blog module?

Share this post


Link to post
Share on other sites

Thanks @Knight we are both asking the same question but it seems we might have to create a function in our init.php and paste the same code from MarkupBlog in order to change the structure from the code. I want to reformat the markup, because i have a template for the blog and i want it to follow that template structure. 

Share this post


Link to post
Share on other sites

Peter & Sephiroth,

It is trivial to add extra fields pulled from any PW page into the generated output without having to modify the blog module code.

When you call the renderPost() function (or any of the blog functions), you'll get the markup. Using something like QueryPath (http://querypath.org/), you can convert your blog markup into a DOM object that responds to jQuery-like CSS3 selectors and modify the markup, adding whatever you want into the DOM tree. When you are done, then simply call the html() method on the modified QueryPath object and echo the converted markup into your PW template.

I hope this helps.

  • Like 1

Share this post


Link to post
Share on other sites

I'm definitely missing some key logic here. 

If I look at my current blog-post.php template, the entire contents of that template are

<?php 

/**
 * Post template
 * Demo template file populated with MarkupBlog output and additional custom code for a Blog Post
 *
 */

	//CALL THE MODULE - MarkupBlog
	$blog = $modules->get("MarkupBlog");
        
    //subnav
    $subNav = '';
    
    //subnav: get date info for creating link to archives page in subnav
    $date = $page->getUnformatted('blog_date'); 
    $year = date('Y', $date); 
    $month = date('n', $date); 

    //subnav: if there are categories and/or tags, then make a separate nav for them
    if(count($page->blog_categories)) $subNav .= $blog->renderNav(__('Related Categories'), $page->blog_categories); 
    if(count($page->blog_tags)) $subNav .= $blog->renderNav(__('Related Tags'), $page->blog_tags); 

    //subnav: contains authors, archives and categories links
    $authorURL = $pages->get('template=blog-authors')->url;
    $archivesURL = $pages->get('template=blog-archives')->url;

    $subNavItems = array(
                            $authorURL . $page->createdUser->name . "/" => $page->createdUser->get('title|name'), 
                            $archivesURL . $year . "/" . $month . "/" => strftime('%B %Y', $date)
    );

    $subNav .= $blog->renderNav(__('See Also'), $subNavItems);

     //main content
    
    //render a single full post including title, comments, comment form + next/prev posts links, etc
    //$blog->postAuthor(): if available, add 'post author widget' at the end (or at the top if desired) of each post
   // $content = $blog->renderPosts($page) . $blog->renderComments($page->blog_comments) . $blog->renderNextPrevPosts($page);//without post author

    /*
        for this demo, renderComments() has to adapt to whether blog commenting feature was installed or not whilst remaining blog structure/style-agnostic
        in your own blog install, you would know if you enabled the feature so there would be no need for such a check
		in addition, our 'check' code is not code you would normally use in a template file. 
		we use such code here to be both foolproof that the commenting feature is installed and blog structure-agnostic 
    */
    #not foolproof; user could have post-installed custom commenting feature (e.g. Disqus) with a similar field blog_comments
	//$renderComments = $page->template->hasField('blog_comments') ? $blog->renderComments($page->blog_comments) : '';

    $blogConfigs = $modules->getModuleConfigData('ProcessBlog');

    $renderComments = $blogConfigs['commentsUse'] == 1 ? $blog->renderComments($page->blog_comments) : '';   

    $content = $blog->renderPosts($page) . $blog->postAuthor() . $renderComments . $blog->renderNextPrevPosts($page);//with post author widget 	
    
    //include the main/common markup
    require_once("blog-main.inc");

I can see towards the end that Kongondo has a content variable and is outouts

Page

Author

Comments

Next / Previous links

I guess the black hole for me is - where is the html markup which wraps around these? it's not in blog-post.php and we're not supposed to touch blog.module.  ???

Perhaps I'm approaching this with my old MODX mindset and the Articles school of templating where each part of the blog (posts, comments, Tags) had their own mni template with html.

Share this post


Link to post
Share on other sites

For now due to time will work with this, but might have to create a different module that allows control over the template. sadly no free time.

Share this post


Link to post
Share on other sites

Here is my blog-post template:

<?php

$spex->setLayout('two-column');

$blog = $modules->get('MarkupBlog');

$blogPost = $blog->renderPosts($page, false, [ 'post_large_headline_tag' => 'h1', 'post_comments' => 0 ]);

$dom = $modules->get('BlogMicrodata');

echo $spex->partial('blog_post', [ 'blog_post' => $dom->enrich($blogPost) ]);

$spex->slot('sidebar_content', $spex->partial('blog_categories') . $spex->partial('blog_tags'));

?>

<?php $spex->docReady() ?>

<?php $spex->docReady() ?>

I'm simply calling renderPost(), passing its output into my module (BlogMicrodata) via $dom->enrich($blogPost) (which decorates the blog markup with microdata) that in turn is passed into a partial, that in turn is echoed into a template called "two-column".

I've chosen to use the Spex module for my templating mechanism. Irrespective, it all resolves into a target DIV in a PHP file. All of the blog markup is returned from renderPosts(). All you need to do is echo that markup into your wrapper template.

Share this post


Link to post
Share on other sites

@ kongondo: I experience a problem truncating posts.

When I render renderPosts like you described on your blog. All posts truncate fine. When I use the included template posts will not truncate. I only altered blog-main.

blog-main

<?php
    $topNavItems = array();
    $templates = array('blog-archives');
    foreach ($templates as $t) {

        $p = $pages->get("template=$t");
        if($p->id)  $topNavItems[] = $p;
    }
    $topNav = $blog->renderNav('', $topNavItems, $page);
?>
<?php include("./head.inc"); ?> 

<div class="container blog-container">
	<div class="row">
		<div class="col-md-8">
			<div class="row">
				<div class="col-md-12">
					<h2>Blog</h2>
				</div>
			</div>
			<div class="row">
				<div class="col-md-12">
					<?php
					$noAuthor = $pages->get('template=blog-widget-basic, name=post-author, include=all')->is(Page::statusUnpublished) ? ' no-author' : '';
            		?>		
					<div><?php echo $content?></div>
				</div>
			</div>
		</div>
		
		<div class="col-md-4 link6 hidden-xs" id="blog-col-sidebar">
			<p id="zoekblog">Zoek in:</p>
			<div id="top-nav"><?php echo $topNav;?></div>
		</div>
	</div>
</div>

<?php include("./foot.inc"); ?>  

blog-posts (did not changed this template, renderpost is set to true )

    //main content
    $content = '';
    $content .= "<h2>{$page->get('blog_headline|title')}</h2>";
    //render a limited number of summarised posts
    $content .= $blog->renderPosts("limit=5", true); 

 This is my output

Share this post


Link to post
Share on other sites

Hi @toothpaste,

To prove it out, why not try something like this

$posts = $pages->find('template=blog-post, limit=5');

and see whether you get the page posts you expect in the page array.

If you do, then try this:

$content .= $blog->renderPosts($posts, true);
  • Like 1

Share this post


Link to post
Share on other sites

Found the problem. The Blog page is linked to blog.php. Changed

$content .= $blog->renderPosts("limit=$limit");

to

$content .= $blog->renderPosts("limit=$limit,true");

Sorry...., dumb of me. Got to learn more about the structure of the template demo files.

  • Like 1

Share this post


Link to post
Share on other sites

Thanks @Knight we are both asking the same question but it seems we might have to create a function in our init.php and paste the same code from MarkupBlog in order to change the structure from the code. I want to reformat the markup, because i have a template for the blog and i want it to follow that template structure. 

Still curious exactly what your template structure looks like...

Share this post


Link to post
Share on other sites

I'm definitely missing some key logic here. 

If I look at my current blog-post.php template, the entire contents of that template are

<?php 
    
    //include the main/common markup
    require_once("blog-main.inc");

I can see towards the end that Kongondo has a content variable and is outouts

Page

Author

Comments

Next / Previous links

I guess the black hole for me is - where is the html markup which wraps around these? it's not in blog-post.php and we're not supposed to touch blog.module.  ???

Perhaps I'm approaching this with my old MODX mindset and the Articles school of templating where each part of the blog (posts, comments, Tags) had their own mni template with html.

The HTML comes from two places:

1. From the various render methods in MarkupBlog (e.g., have a look at renderPosts())

2. From blog-main.inc - we inject variables we have previously set in this file, e.g. $content

<div id="main" class="block<?php echo $noAuthor?>"><?php echo $content?></div> <!-- #main -->

Share this post


Link to post
Share on other sites

For now due to time will work with this, but might have to create a different module that allows control over the template. sadly no free time.

I've been looking at creating my own templates and test pages and adding some much more lo-fi / basic code.

As Kongondo says, the templates provided are just examples and you could output any markup you wish by making your own templates.

For example, if you wish to create your own blog-post.php template, you can make a template called blog-post-custom.php etc and manually call a few fields.

Here's the body of an extremley basic blog post template. It relies less on variables within other files and includes. 

<!-- Get the title in a H3 tag-->
   <h3><?php echo $page->title; ?></h3>

<!-- Get the body -->
   <?php echo $page->blog_body; ?>

<!-- Get the comments -->
   <?php echo $page->blog_comments->render(); ?>

<!-- Get the comment form -->
   <?php echo $page->blog_comments->renderForm(); ?>

               

Likely it bypasses much Kongondos genius but this would actually suffice for my requirements. 

I'm not sure how I would grab the number of comments this page has but I'll figure it out.

  • Like 1

Share this post


Link to post
Share on other sites

I might jump in here too and ask the same thing. Hopefully we're asking the same question.

Currently, my /blog/posts/ page lists all my posts in the structure as follows

  • Post Title
  • Posted by Author Name. Date and Time
  • Post summary with ellipses at approx 50 words

If we want to change this to add the contents of a field such as

  • Post Title
  • Post_Summary field
  • Posted by Author Name. Date and Time
  • Post summary with ellipses at approx 50 words

would we need to edit the file called MarkupBlog.module ?

And if so, how is that not overwritten when we perform an update to the Blog module?

Not in this particular case, but there are times when a str_replace would suffice. In this case it would be a bit hacky :-)....

Btw, is a 'summary field' like this a common feature of Blogs?

Anyway, your question got me thinking, so thanks for asking :-)....Given your example, there's maybe 3 options to enable you to inject your custom fields inside Blog Markup (i.e. modify the markup server-side).

Option 1. Add an post_extra_fields => array()

I could add an 'array option' in renderPosts() 3rd argument, i.e. $options for specifying any extra fields (that return strings) that a user might want to inject in their markup (e.g. your post_summary field), i.e. a post_extra_fields => array()

$options = array(

                    'post_small_image' => 3,
                    'post_small_image_width' => 250,
                    'post_comments_label'=>'',
                    'post_extra_fields' => array('post_summary' => 1, 'post_teaser' => 4, 'post_other_field' => 3);
);

The numbers in the values inside 'post_extra_fields' (e.g. 1 in 'post_summary') refer to the position (see illustration below) where you want that extra field to appear within the Blog Post

post-894-0-33757900-1419103558_thumb.png

Option 2. Add other methods to output various parts of Blog Posts

In this option, those who wish to use renderPosts() can do so but those who want finer control can use these other methods, i.e.

renderPostTitle()

renderPosByline()

renderPostBody()

renderPostCategories()

renderPostTags()

.....but hold it right there. What is wrong with this picture? renderPostTitle()! Why create a method to do what ProcessWire already does ($page->title) and does well!? :D Option #2 (and probably the first one too) is dead in the water and I'll show you why in option #3 below.

Option 3. Use both native ProcessWire methods/properties and MarkupBlog methods as applicable

I will need to put this in the Blog Docs as well. What I should have been clear about in the Blog Docs is that you do not have to use renderPosts() to output the main content of your Blog Post (i.e., post title, post body, etc). You can, if it suits your needs, use native PW methods/properties, especially if you want full control over your Posts structure and Markup. Nothing stops you from combining these with MarkupBlog methods. For instance, you can use MarkupBlog to render your Blog's tags, categories, authors, archives, etc but use ProcessWire methods/properties to render your Blog Post including adding content from any other extra fields you have anywhere on your site. 

So instead of:

$content = $blog->renderPosts($page, '', $options) . $blog->postAuthor() . $blog->renderComments($page->blog_comments) . $blog->renderNextPrevPosts($page);//with post author

in your blog-post.php...you can have:

$content = $body . $blog->postAuthor() . $blog->renderComments($page->blog_comments) . $blog->renderNextPrevPosts($page);//with post author

..where $body is a variable holding your custom content (blog_body, post_summary, $page->title, etc). I will write a full example in a post below.

So, back to the original question. How do we inject extra content or have full control over our Blog Post Markup if we do not want to or cannot use str_replace, etc.? Use option #3. Unless convinced otherwise, this is the option I will be recommending (hence, for now at least, will not be adding option #1 to renderPosts()).

OK, let me finish writing the example option #3...

  • Like 2

Share this post


Link to post
Share on other sites

Btw, is a 'summary field' like this a common feature of Blogs?

Think it depends on the designer/developer.

I like to have a summary on blog-posts at least as sometimes you wish to keep the title short but then have a longer summary.

Originally, I did that for SEO reasons too.

Share this post


Link to post
Share on other sites

........I'm not sure how I would grab the number of comments this page has but I'll figure it out.

:-)

$numComments = $page->blog_comments->count();

OK, let me finish writing the example option #3...

@Peter beat me to it...https://processwire.com/talk/topic/7403-module-blog/?p=83118

If anybody else wants more examples let me know...

  • Like 1

Share this post


Link to post
Share on other sites

If anybody else wants more examples let me know...

Can you point me in the right direction for mirroring a list of pages by say, archive (month) or authors or categories.

For example, the Archives page might have:

December 2014

Post 1 Title

Post 2 Title

November 2013

Post 1 Title

Post 2 Title

For example, the Categories page might have:

Category A

Post 1 Title

Post 2 Title

Category B

Post 1 Title

Post 2 Title

In MarkupBlog Module, you're using this. is it less verbose if it's done with native PW methods?

	public function renderArchives(Array $years, Array $options = null) {

		$out = '';

		//default options for archives
		$defaultOptions = array(

							'archives_posts_text' =>$this->_('post,posts'),//come in the format 'singular,plural' for e.g. October 5 'posts'
							'archives_month_view_all_text' => $this->_('View All'),//'view all' that month's archives if limit set on amount to list
		);

		//merge user options with default archives options
		if($options != null && is_array($options)) $options = array_merge($defaultOptions, $options);
		else $options = $defaultOptions;

		list($singular, $plural) = explode(',', $options['archives_posts_text']);//come in the format 'singular,plural'	
		$post = '%d ' . $singular;
		$posts = '%d ' . $plural;

		foreach($years as $year=>$y) {
			
				$year 	=  $y['name'];
				$total 	=  $y['total']; 
				$months =  $y['months'];//this is an array
				$url 	=  $y['url']; 

				$out .= "<div class='archive'>
						<h3><a href='$url'>$year</a></h3>
						<span class='num-posts'>" . sprintf(_n($post, $posts, $total), $total) . "</span>";
						

				$out .= "<ul class='posts-group'>";

				foreach($months as $monthNum => $month){

							$out .= "<li><a href='" . $month['url'] . "'>" . $month['name'] . "</a>";
							$out .=  "<span class='num-posts'>" . sprintf(_n($post, $posts, $month['total']), $month['total']) . "</span>";

							if(count($month['posts'])) {//posts will be empty if $blog->archives() call specified 0 for limit;

									$out .= "<ul>";

									foreach($month['posts'] as $item){
											
											$out .= "<li><a href='$item->url'>$item->title</a></li>";
									}

									if($month['total'] > count($month['posts'])){
											
											$out .= "<li><a class='more' href='" . $month['url'] . "'>" . $options['archives_month_view_all_text'] . "</a></li>";
									}

									$out .=  "</ul>";

							}

							$out .=  "</li>";

				}//end foreach $months as $monthNum

				$out .= "</ul></div>";

		}//end foreach $years as $year

		return $out; 
	}

Share this post


Link to post
Share on other sites

@Peter, I am afraid I don't follow :-)...Isn't that what you already have? What do you mean mirroring pages? And where?...I'm just slow that way  :P

Share this post


Link to post
Share on other sites

@kongondo: I'am running your blog and like it a lot. At this point I would like to add the option so people can give a comment. But I installed the blog without the comment feature.

Is it possible enable comments without starting over and install a fresh blog?

post-2698-0-05624500-1419423006_thumb.pn

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By d'Hinnisdaël
      Happy new year, everybody 🥬
      I've been sitting on this Dashboard module I made for a client and finally came around to cleaning it up and releasing it to the wider public. This is how it looks.
      ProcessWire Dashboard

      If anyone is interested in trying this out, please go ahead! I'd love to get some feedback on it. If this proves useful and survives some real-world testing, I'll add this to the module directory.
      Download
      You can find the latest release on Github.
      Documentation
      Check out the documentation to get started. This is where you'll find information about included panel types and configuration options.
      Custom Panels
      My goal was to make it really simple to create custom panels. The easiest way to do that is to use the panel type template and have it render a file in your templates folder. This might be enough for 80% of all use cases. For anything more complex (FormBuilder submissions? Comments? Live chat?), you can add new panel types by creating modules that extend the DashboardPanel base class. Check out the documentation on custom panels or take a look at the HelloWorld panel to get started. I'm happy to merge any user-created modules into the main repo if they might be useful to more than a few people.
       Disclaimer
      This is a pre-release version. Please treat it as such — don't install it on production sites. Just making sure 🍇
      Roadmap
      These are the things I'm looking to implement myself at some point. The wishlist is a lot longer, but those are the 80/20 items that I probably won't regret spending time on.
      Improve documentation & add examples ⚙️ Panel types Google Analytics ⚙️ Add new page  🔥 Drafts 🔥 At a glance / Page counter 404s  Layout options Render multiple tabs per panel panel groups with heading and spacing between ✅ panel wrappers as grid item (e.g. stacked notices) ✅ Admin themes support AdminThemeReno and AdminThemeDefault ✅ Shortcuts panel add a table layout with icon, title & summary ✅ Chart panel add default styles for common chart types ✅ load chart data from JS file (currently passed as PHP array) Collection panel support image columns ✅ add buttons: view all & add new ✅
    • By Pip
      Hi everyone!
      I'm trying out the Login/Register module for my site. Noted that the module assigns the newly registered user to login-register role. 
      Once you modify the login-register role's permissions, particularly adding page-edit, the new member role will be set to guest. 
      Thing is I'd like to grant my new users the power to create their own pages. Any advice? 
      Thanks. 
    • By Gadgetto
      SnipWire - Snipcart integration for ProcessWire
      Snipcart is a powerful 3rd party, developer-first HTML/JavaScript shopping cart platform. SnipWire is the missing link between Snipcart and the content management framework ProcessWire.
      With SnipWire, you can quickly turn any ProcessWire site into a Snipcart online shop. The SnipWire plugin helps you to get your store up and running in no time. Detailed knowledge of the Snipcart system is not required.
      SnipWire is free and open source licensed under Mozilla Public License 2.0! A lot of work and effort has gone into development. It would be nice if you could donate an amount to support further development:

      Status update links (inside this thread) for SnipWire development
      2020-07-03 -- SnipWire 0.8.7 (beta) released! Fixes some small bugs and adds an indicator for TEST mode 2020-04-06 -- SnipWire 0.8.6 (beta) released! Adds support for Snipcart subscriptions and also fixes some problems 2020-03-21 -- SnipWire 0.8.5 (beta) released! Improves SnipWires webhooks interface and provides some other fixes and additions 2020-03-03 -- SnipWire 0.8.4 (beta) released! Improves compatibility for Windows based Systems. 2020-03-01 -- SnipWire 0.8.3 (beta) released! The installation and uninstallation process has been heavily revised. 2020-02-08 -- SnipWire 0.8.2 (beta) released! Added a feature to change the cart and catalogue currency by GET, POST or SESSION param 2020-02-03 -- SnipWire 0.8.1 (beta) released! All custom classes moved into their own namespaces. 2020-02-01 -- SnipWire is now available via ProcessWire's module directory! 2020-01-30 -- SnipWire 0.8.0 (beta) first public release! (module just submitted to the PW modules directory) 2020-01-28 -- added Custom Order Fields feature (first SnipWire release version is near!) 2020-01-21 -- Snipcart v3 - when will the new cart system be implemented? 2020-01-19 -- integrated taxes provider finished (+ very flexible shipping taxes handling) 2020-01-14 -- new date range picker, discount editor, order notifiactions, order statuses, and more ... 2019-11-15 -- orders filter, order details, download + resend invoices, refunds 2019-10-18 -- list filters, REST API improvements, new docs platform, and more ... 2019-08-08 -- dashboard interface, currency selector, managing Orders, Customers and Products, Added a WireTabs, refinded caching behavior 2019-06-15 -- taxes provider, shop templates update, multiCURL implementation, and more ... 2019-06-02 -- FieldtypeSnipWireTaxSelector 2019-05-25 -- SnipWire will be free and open source Plugin Key Features
      Fast and simple store setup Full integration of the Snipcart dashboard into the ProcessWire backend (no need to leave the ProcessWire admin area) Browse and manage orders, customers, discounts, abandoned carts, and more Multi currency support Custom order and cart fields Process refunds and send customer notifications from within the ProcessWire backend Process Abandoned Carts + sending messages to customers from within the ProcessWire backend Complete Snipcart webhooks integration (all events are hookable via ProcessWire hooks) Integrated taxes provider (which is more flexible then Snipcart own provider) Useful Links
      SnipWire in PW modules directory SnipWire Docs (please note that the documentation is a work in progress) SnipWire @GitHub (feature requests and suggestions for improvement are welcome - I also accept pull requests) Snipcart Website  

       
      ---- INITIAL POST FROM 2019-05-25 ----
       
    • By Sten
      Hello
      Till now I hacked something with the twig template but it works no more with new PW versions so I look forward to create a module. I am working on a site in multiple languages : French, English, Italian, German, Spanish, Portuguese, Hebrew, Russian. The new posts are entered in any language with a field for language. Till now, I got twig files to get the translations with constants defined for each part of the pages.
      So I'd like to create a module to include theses files added according to the url /fr/en/...
      Have you some observations to do before I begin about the direction to take ?
      Thank you
    • By ukyo
      Mystique Module for ProcessWire CMS/CMF
      Github repo : https://github.com/trk/Mystique
      Mystique module allow you to create dynamic fields and store dynamic fields data on database by using a config file.
      Requirements
      ProcessWire 3.0 or newer PHP 7.0 or newer FieldtypeMystique InputfieldMystique Installation
      Install the module from the modules directory:
      Via Composer:
      composer require trk/mystique Via git clone:
      cd your-processwire-project-folder/ cd site/modules/ git clone https://github.com/trk/Mystique.git Module in live reaction with your Mystique config file
      This mean if you remove a field from your config file, field will be removed from edit screen. As you see on youtube video.
      Using Mystique with your module or use different configs path, autoload need to be true for modules
      Default configs path is site/templates/configs/, and your config file name need to start with Mystique. and need to end with .php extension.
      Adding custom path not supporting anymore !
      // Add your custom path inside your module class`init` function, didn't tested outside public function init() { $path = __DIR__ . DIRECTORY_SEPARATOR . 'configs' . DIRECTORY_SEPARATOR; Mystique::add($path); } Mystique module will search site/modules/**/configs/Mystique.*.php and site/templates/Mystique.*.php paths for Mystique config files.
      All config files need to return a PHP ARRAY like examples.
      Usage almost same with ProcessWire Inputfield Api, only difference is set and showIf usage like on example.
      <?php namespace ProcessWire; /** * Resource : testing-mystique */ return [ 'title' => __('Testing Mystique'), 'fields' => [ 'text_field' => [ 'label' => __('You can use short named types'), 'description' => __('In file showIf working like example'), 'notes' => __('Also you can use $input->set() method'), 'type' => 'text', 'showIf' => [ 'another_text' => "=''" ], 'set' => [ 'showCount' => InputfieldText::showCountChars, 'maxlength' => 255 ], 'attr' => [ 'attr-foo' => 'bar', 'attr-bar' => 'foo' ] ], 'another_text' => [ 'label' => __('Another text field (default type is text)') ] ] ]; Example:
      site/templates/configs/Mystique.seo-fields.php <?php namespace ProcessWire; /** * Resource : seo-fields */ return [ 'title' => __('Seo fields'), 'fields' => [ 'window_title' => [ 'label' => __('Window title'), 'type' => Mystique::TEXT, // or InputfieldText 'useLanguages' => true, 'attr' => [ 'placeholder' => __('Enter a window title') ] ], 'navigation_title' => [ 'label' => __('Navigation title'), 'type' => Mystique::TEXT, // or InputfieldText 'useLanguages' => true, 'showIf' => [ 'window_title' => "!=''" ], 'attr' => [ 'placeholder' => __('Enter a navigation title') ] ], 'description' => [ 'label' => __('Description for search engines'), 'type' => Mystique::TEXTAREA, 'useLanguages' => true ], 'page_tpye' => [ 'label' => __('Type'), 'type' => Mystique::SELECT, 'options' => [ 'basic' => __('Basic page'), 'gallery' => __('Gallery'), 'blog' => __('Blog') ] ], 'show_on_nav' => [ 'label' => __('Display this page on navigation'), 'type' => Mystique::CHECKBOX ] ] ]; Searching data on Mystique field is limited. Because, Mystique saving data to database in json format. When you make search for Mystique field, operator not important. Operator will be changed with %= operator.
      Search example
      $navigationPages = pages()->find('my_mystique_field.show_on_nav=1'); $navigationPages = pages()->find('my_mystique_field.page_tpye=gallery');
×
×
  • Create New...