Jump to content


  • Posts

  • Joined

  • Last visited

Posts posted by neildaemond

  1. awesome! That's pretty straight forward... I guess I should have looked at the core, but I thought someone might already be doing this sort of thing~

    You can assign fields to templates like this:
     $template = $templates->get("some_template"); $template->fields->add("newfield"); $template->fields->save(); 

    this code is taken from here http://processwire.c...bles/templates/ So, just make an array with all the templates you want the field to be on, and go for it :)

    $ts = array("home", "basic-page", "search"); foreach($ts as $t){ $template = $templates->get($t); $template->fields->add("newfield"); $template->fields->save(); }

    EDIT: the field will be on the last position of each template

    Thanks! I think I'll start off by making fields in the gui, then just adding the field to templates should be a breeze using this script... I'll try creating fields and templates after i get a little more comfortable... maybe even try doing it through the php command line interface. That'll be the boss round though.

    Hey neil (are you neil?)

    yes, I am :)

  2. Hi,

    Is there an easy way to add fields and then assign it to templates besides going through the admin gui? I find it slows down development anytime I think of a new field and have to manually add it then assign it to all the templates I need it in... (would be a nice feature if we could add the field to multiple templates at the time of creating the new field)

    Looking at the cheatsheet, I see I can see how to set the name, title, and label of a field using $field->name ... etc.

    checking the advanced tab in the cheatsheet I can see the the the $fields-save() etc...

    but I'm not really sure how to create a field object or what its structure is like~

    does anyone create these via scripts? how do you guys do it?

    • Like 1
  3. Very Slick! I love the design and animations, if only I knew German I'd totally follow your blog.

    another great line: "Proudly powerd by WordPress Processwire"

    Your comment box looks good, I have yet to update mine as per your last suggestions.

    Also, I got an error when clicking your archive graph... I'm running Ubuntu + Firefox if it helps

    But, Great stuff overall!

  4. I added one simple line to more easily edit the current page, or add parent sibling and child pages. This way, I don't have to navigate through the admin every time I want to add or edit. I added into my head.inc so that its included on every page:

    			echo "<br/><a href='{$config->urls->admin}page/edit/?id={$page->id}'>Edit Page</a> | <a href='{$config->urls->admin}page/add/?parent_id={$page->id}'>Add New Child Page</a> | <a href='{$config->urls->admin}page/add/?parent_id={$page->parent_id}'>Add New Sibling Page</a> <br/><br/>";
    • Like 1
  5. LOL, I just stumbled onto this... thanks for making my site the example :D:D... But, I'm sure there are a lot of better examples to model your site after~

    Stan, how is your html and css? Even if you're starting out, you'll find Processwire a great facilitator to help you learn these fundamental web languages, especially if you want to learn a bit about php! You won't learn them using Wordpress or Drupal...

    And the support you'll receive in the forums is quite unmatched... chances are the creator of Processwire himself (ryan) will respond to your question (like he did with this one) with the most elegant answers imaginable.

    Anyways, let us know your background in web dev, and we'll try help you out~

    • Like 1
  6. Hi,

    I read in the roadmap about "Comments fieldtype improvements". So are they finished already or are you still working on it? Because I have some suggestions:

    • Add a "website" field
    • Save name, e-mail and website in cookies and load them automatically in the comment form if they're existing
    • Execute comment saves before rendering a page because it's problematic if you want to show e.g. "5 comments"
    • Add a "$comment->avatar" working with gravatar (or is it already?)


    I was just about to ask how I could add a website field to my comment forms in 2.1... is it not yet (reasonably) possible then?

  7. My RSS Feeds seem to only show the title of the Item ( I used the above mentioned code to modify the title of the items). I noticed in MarkupRSS.module that the $defaultConfigData array has

    itemDescriptionField => 'summary'

    My pages don't have a summary field.

    Is there a way to make my RSS feed show more than just a title? ie some of the $body? I tried changing the module code to

    itemDescriptionField => 'body'

    but it didn't work. Also, I edited the module without reloading it anyhow, could that have made it not work?


  8. One way to do categories is to have them as page fields.

    That's how I did it in my cheat sheet section... but for sorting my blog topics, I was worried about changing the category page field of many pages.

    My site is little so I feel a little bit guilty dragging this thread on (I really appreciate the feed back and have learned a few best practices along the way though). My main goal is for someone to easily see the topics which I have experience with, and that makes it important for me to categorize things nicely and maybe re categorize things as my experience evolves. I will rethink my categorizing strategy and post the results.

  9. if you keep moving published content, you'll hurt your search engine rankings, especially if it's a page that's been indexed for a while.

    very good point! Search engine rankings are always a good reason to do something different.

    I have to confess that, knowing "perma links" are a kind of buzz word these days, I had a feeling those who have been in the business longer will have something to say about them. I'm glad to hear the response, thanks guys! From now on, I think I'll try keep my url structures put.

  10. I totally agree with you Ryan, its best when you have a permanent URL structure. I followed this ideal when I created my "Cheatsheet" Section. All my cheat sheet pages were under their own folder, then there was a tree structure for the categories which could be 'tagged' via a page field within the cheat sheet.

    However, the ability to easy move pages around in the admin section tempted me to categorize my Blog Categories solely by the path of the entry. This made me wonder what I was going to do if I sorted it by moving pages around in the admin. Doesn't $page->url provide the url path? If I changed the path of the page, then surely the url would change, right?

    One reason I brought up the topic of perma links is that, to me, it seemed easy enough to implement given PW's api. Also, I was looking for a reason that using them would cause problems. I can foresee the situation where someone just copies and pastes the link 6from the address bar instead of using the "Share me" link (which uses the perma link) to share the page/entry. Another fail could be when posted to facebook or something, the link might just stay as a text link instead of showing the icon,title and description... I'll have to test.

    I guess it boils down to a flaw with with my category tree method instead of just using tags. Tags allow the page to remain where you made it, while sorting your blogs by their file path will result in changed urls if you move it.

    Generally, I think tags are good, but I just wanted to try something different (while utilizing the usability of PW's admin). I felt that perma-links would give me a one-time solution as opposed to creating redirects each time I move a page.

  11. before I add in one of those "FB,TWITTER,TUMBLR..etc" things to my blog, I was thinking of adding some sort of perma links functionality to my site so that If I ever re-organize the page structure from the the admin, the fact that the link changed wont matter.

    I was thinking about doing something like this:

    $name = $page->name
    $template = $page->template
    echo "<a href='http://www.neilpahl.com/perma-link?name={$name}&template={$template}'>perm-link to this page</a>";

    then the permalink template would look something like this:

    $findName = $sanitizer->name($_GET["name"]);
    $findTemplate = $sanitizer->name($_GET["template"]);
    $redirectLink = $pages->get('template={$findTemplate}, name={$findName})->url;
    header("Location: {$redirectLink}");

    I haven't tried it yet, and its my first time to use GET variables (thank goodness for the $sanitize function). Is there a more common way of implementing perma-links? Is there anything wrong with the method I'm suggesting? (there MUST be something wrong with the syntax at least)

  12. A nice and simple solution!

    And I guess if I want to be able to select different 'brush' classes, then I'd have to go the way you mentioned... "(using styleselect in the buttons1, using theme_advanced_styles and modifying TinyMCE content.css)"

    I ended up just sticking with the basic <pre> tag, however... BUT, perhaps when I start blogging more about code, I'll look back into syntax highlighting.. and update this post with my results.

    Thanks again!

  13. Added new features to the site... Everyone says that wordpress and things are good for blogs, but I was having so much fun with PW that I used it to create my custom blog engine.

    I tried my own approach to blogs when I added a "Logs" section to my page. I use these logs to document various topics that I am toying with. I use category templates to implement a topic tree, then each category has child pages which are the log entries. This way, the topics are organized nicely and they can be selected to show a paginated list of the topic's entries. It implements the pagination module (not enough entries yet, but it worked on my staging site) to limit the entry list to 5 entries per page.

    next, I plan to add some forms which I can see when I'm logged in to add new entries quicker. However, I haven't figured out how to create new pages through code yet.


    P.S. - I have yet to add the "Log" which talks about my experiences with PW and such. Alos, I'm using the PW cheatsheet more often now and it is great!

  14. If you see the gray box, try resizing the browser window and the map should appear. All it needs is a slight resize of the window and it should work as expected (tested on processwire 2.1 with Chrome, Safari, Firefox).

    You have to do this every-time you want to use the map (little bit annoying).

    Sorry, I didn't notice the reply and ended up working on something else in the meantime, but thanks for the reply, I'll try this out again shortly :)

  15. i wanted to use SyntaxHighlighter(http://alexgorbatchev.com/SyntaxHighlighter/manual/installation.html) on my page.

    The section of code to be highlighted should be wrapped with the <pre> tag, but also with a class like:

    <pre class="brush: js">code</pre>

    I know selecting the 'pre' format form the dropdox box will surround my text with <pre>,  but is there a way to add more options to that dropbox which will also add the appropriate class?

    Thanks in advance,

  • Create New...