Jump to content

Blog Profile


ryan

Recommended Posts

Thanks! I've been lurking in the shadows for awhile now and working on my first big project. I'm loving it more and more.

That worked like a charm. When I'm done with this project, I'm going through each line of code to see if I can become fluent. I'm like a kid in a candy store with this CMS.

  • Like 5
Link to comment
Share on other sites

  • 4 weeks later...

Hello. Can you help me?

I work with Blog Profile.

There is a subnav "Categories" in the left panel. I need one more subnav "Years".

So I created new field "years", page "years" with template "categories", and child pages: "3-5_years", "7-8_years"... with "category" template (the same as for "Categories" subnav). And then filled it in all posts.

Next, I added new lines here:

1. blog.inc

       $subnav = '';     // subnav, as it appears in the left sidebar
->    $subnav_years = '';
 
2. home.php
    
      $categories = $pages->get('/categories/'); 
->   $years = $pages->get('/years/');
 
      $subnav = renderNav($categories->title, $categories->children); 
->   $subnav_years = renderNav($years->title, $years->children);
 
3. And now, if i choose only one line in category.php
 
     $posts = $pages->find("template=post, categories=$page, limit=10");
  //$posts = $pages->find("template=post, years=$page, limit=10");
 
or
 
  //$posts = $pages->find("template=post, categories=$page, limit=10");
     $posts = $pages->find("template=post, years=$page, limit=10");
 
then I can see blogs only for selected "categories" or for "years" respectively.
 
But if i do two line:
 
     $posts = $pages->find("template=post, categories=$page, limit=10");
     $posts = $pages->find("template=post, years=$page, limit=10");
 
only last will work. And it is "No posts found" for first line.
 
But I need two subnav work properly at the same time. I should use || , i think. But don't know how.
Link to comment
Share on other sites

Ok, I figured it out.

Not yet...

I think, it should be something like:

category.php

if  $page->parent->name=categories {

 $posts = $pages->find("template=post, categories=$page, limit=10");

...

}

if $page->parent->name=years {

 $posts = $pages->find("template=post, years=$page, limit=10");

...

}

But I am not a php programer, so I don,t know how to write it properly.
Link to comment
Share on other sites

Not exactly sure what you are still having problems with, but this line:

if  $page->parent->name=categories {

needs to be:

if($page->parent->name=="categories"){

Same goes for the years if statement.

Does that fix things for you, or are there other problems?

  • Like 1
Link to comment
Share on other sites

No problem. PW is incredibly flexible - more so than probably any other CMS/CMF, but it does require that you learn at least some basic php. Mostly foreach and if/else will get you going. I would definitely recommend googling a few tutorials on the possible options/rules for these statements so you can better understand the syntax. It can seem a little confusing at first, but once you get a handle on the basic rules, it really is pretty easy!

  • Like 2
Link to comment
Share on other sites

  • 1 month later...

In their blog profile install, using PW2.4, could someone please confirm that they can view the option "PageAutocomplete" as one of the Inputfield field type selections in the drop down in /setup/fields/input (admin)? Although the page field called "tags" works fine when editing  a "post", PageAutocomplete does not appear in the field edit screen. It also means I cannot add a field of that type. Currently, the "tags" field "appears" as a "Select". If I save the field settings, it now also disappears in the edit a "post" page. And yes, automplete is listed as installed. Thanks!

Does the above even make sense? I'm having one of those days!!!

Link to comment
Share on other sites

@kongondo - I can confirm that "PageAutocomplete" is not visible under "Input field type" when looking at the field "tag" in the current blog profile and on PW 2.4. 

PageAutocomplete is visible on another field (page type) in a custom profile I have running on that same host. Can't explain this one. 

Test platform: PHP 5.5.10 (MAMP PRO 3.03) on OS X. 

Link to comment
Share on other sites

  • 3 months later...

I am very new to ProcessWire. I just installed it, and then saw Blog Profile.

Is there a way to put the Blog Profile into my install? Or do I have to do a new install?

Thanks for any advice that you can provide.

Jim

Link to comment
Share on other sites

Hi,
I installed latest processwire blog and have multilanguage working.
Now I want to have 2 language flags pictures right next to the site title in the top.
The language flag pictures should link to home/en/ and home/es/
I also need a logo to show up left from the site title.

blog.jpg
 

I looked inside /site/templates/main.inc and found there the output for
site title and site Tagline. It is here where I have to insert code to have
the language flag pictures to show up:

 

<div id="site-headline" class="twelve columns alpha">

	<?php echo "<a href='{$config->urls->root}'><h1>{$homepage->headline}</h1></a>"; ?>

	<?php if($homepage->summary) echo "<h5>{$homepage->summary}</h5>"; ?>
</div>
          
<div id="site-search" class="four columns omega">

	<?php
	$searchPage = wire('pages')->get('template=search');
	$searchQuery = htmlentities(wire('input')->whitelist('q'), ENT_QUOTES, "UTF-8");
	?>

	<form id='site-search-form' class='clearfix' action='<?php echo $searchPage->url; ?>' method='get'>
	<input type='text' name='q' value='<?php echo $searchQuery; ?>' placeholder='<?php echo $searchPage->title; ?>'>
	</form>
</div>

No matter what I tried to enter

<a href="link to home/en/"><img src="flag.jpg" alt="bla" width="x" height="y"></a>

before, after or inside:

<?php echo "<a href='{$config->urls->root}'><h1>{$homepage->headline}</h1></a>"; ?>

I just don´t get it right for the language flag pictures show up right next to the site title.

The language picture flags just stay either on top or on the bottom but not right next

to the site title as I showed in the example snapshot above.

Where exactly do I have to insert <a href="link to home/en/"><img src="flag.jpg" alt="blabla" width="x" height="y"></a>

I saw that processwire blog works with the skeleton css grid and I am unfamiliar with it
but maybe the trick is to use another omega or alpha that is part of the skeleton grid ?
 
 

Link to comment
Share on other sites

Maybe you shoud change this <div id="site-headline" class="twelve columns alpha"> to this <div id="site-headline" class="eight columns alpha">

and add new div after that with class="four columns alpha" or something like that?

Link to comment
Share on other sites

  • 10 months later...

Hey guys :-)

Just had the need for letter grouped tags with jumplinks and got this snippet in the end

// output jumplinks
$out .= "<div><ul>";
foreach($tags as $t) {
    $letter = strtoupper(substr($t->name, 0, 1));
    if($letter != strtoupper(substr($t->prev($results)->name, 0, 1))) $out .= "<li><a href='#letter_$letter'>$letter</a></li>";
}
$out .= "</ul></div>";

// output tags grouped by first letter
foreach($tags as $t) {
    $firstLetter = strtoupper(substr($t->title, 0, 1));
    if($firstLetter != strtoupper(substr($t->prev($results)->name, 0, 1))) $out .= "<div><h4 id='letter_$firstLetter'>$firstLetter</h4><ul>";
    $out .= "<li><a href='{$t->url}'>{$t->title}</a></li>";
    if(substr($t->name, 0, 1) != substr($t->next($results)->name, 0, 1)) $out .= "</ul></div>";
}

Just wanted to share, maybe it helps someone ;)  or someone got some improvement ideas :)

EDIT: I just uploaded it to the live site, cause I really like examples myself ;)

http://www.happygaia.com/tags/ (I always wanted to showcase our page properly, maybe next time :) )

The jumplinks could be a little more fancy and the anchor jumping could be nicer too, the letter heading itself is hidden by the sticky menu, but I'm a little lazy right now..

EDIT: After a while I changed this to another approach. Now I'm creating an an associative array first, index is the first letter and values are all page id's, feels more solid. And now it's easier to extend it, like counting all entries for letter A and so on..

Edited by Can
  • Like 1
Link to comment
Share on other sites

  • 1 year later...

Ok , I'm just putting this up here with the hope it might save someone else a bit of time. Both the issues I ran into have been resolved.

I decided to install Ryan Cramer's Blog Profile.

I used PW 2.7.2, and I am on MySQL 5.7.9.

I discovered the first problem I hit had already been reported here : site-blog not appearing in intallation profile dropdown

Of course I decided to Google it AFTER I had figured it out for myself - DUHHH.

The second problem apparently was with the file install.sql located of course in the install folder. This sql was using a zero date '0000-00-00 00:00:00' to populate a timestamp field. I think there were about 90+ instances of this in the sql file. These inserts all threw errors.  I didn't put too much time into looking for a solution on this. I found this but didn't care for allowing bad dates Allow Invalid Dates - MySQL  What I did as a fix, was to change '0000-00-00 00:00:00'  to Now() in the install.sql file and re-ran it. That seems to have worked. When I went back into the Admin I had all greens on the update steps.

Thanks to Ryan four years after the fact for providing us with this ready made Blog profile. Good stuff! I hope to learn from it AND use it as well. Have a good one...

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

Hi,

I would like to install the Blog Profile by following steps:

- download latest PW (devns.zip)

- download Blog Profile zip

- unpack PW and blog profile zips as instructed

- start the web installer 

However I don't see the Blog Profile in the dropdown list of available profiles. I checked the permission of the blog profile carefully, it's the same as other profiles.

Any hint please?

thanks,

Tony 

Link to comment
Share on other sites

@tony Hi,

I have already tried to install the version found in the modules directory, but this one did not work for me either:

http://modules.processwire.com/modules/blog-profile/

Instead, try the version posted by Ryan here (this one worked):

Note: you might want to install it along with a ProcessWire version close to its release date, or at least ProcessWire 2.7 or 2.8. It might work with 3.x too but I have never tried.

One more tip: you might also be interested in this one by @clsource for ProcessWire 3.x:

 

  • Like 2
Link to comment
Share on other sites

  • 4 weeks later...
20 minutes ago, desbest said:

It would be nice if the blog profile worked with processwire 3. Because it isn't, it's harder for newbies to learn how to template processwire.

@desbest...welcome to PW and the forums.

 

Actually, the code in the Blog profile is not really meant for beginners...If you want to learn how to structure your template files I'd recommend these two tuts:

  1. http://processwire.com/docs/tutorials/default-site-profile/
  2. http://processwire.com/docs/tutorials/how-to-structure-your-template-files/
  • Like 1
Link to comment
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.
×
×
  • Create New...