Jump to content

diogo

Moderators
  • Posts

    4,296
  • Joined

  • Last visited

  • Days Won

    79

Everything posted by diogo

  1. A very interesting topic for sure https://www.google.com/search?q=AnnaKus&oq=AnnaKus&aqs=chrome..69i57&sourceid=chrome&ie=UTF-8#q=AnnaKus+how+fast+do+you+type I hope we can stop here.
  2. Can you check if the admin.php file in the templates folder was changed during the installation? if so, it should have these lines: // line added for the Custom Admin Pages Module if($page->template->id !== 2) $page->process = "ProcessAdminCustomPages"; If it doesn't, please replace it by the one on github or add these lines yourself just before the require() https://github.com/ocorreiododiogo/pw-admin-custom-pages/blob/master/admin.php
  3. I apologize in advance if I judged you wrong but before this last post, you had 3 posts and neither of them about Processwire. We don't mind that you comment on other existing posts that are not related to PW, but I just can't let you open a topic with three links in it under these circumstances.
  4. Anna, I also love animals, but unless you post something about Processwire we will have to consider you as a possible spammer.
  5. Just want to add that you can use PW's $input to access cookies: $input->cookie->property_favs
  6. I don't want to complicate things, so until the above is working and understood just ignore this post. If you want the fields to match the theme of the admin, you can use the built in methods to create them. Let's adapt Soma's instructions from here http://processwire.com/talk/topic/2089-create-simple-forms-using-api/ to our example above: <?php if($input->post->submit) { $thought = new Page(); $thought->parent = $pages->get("/thoughts/"); $thought->template = "thought"; $thought->name = time(); // page name can be a timestamp, this will make it unique $thought->title = substr($input->post->thought, 0, 30); // let's make the title match the first 30 characters of the thought $thought->body = $input->post->thought; $thought->save(); // confirmation message with link to edit the new thought echo "<p>A new thought was created. Edit it <a href='{$config->urls->admin}page/edit/?id={$tweet->id}'>here</a>.<br>Create a new one?"; } //create a new form wrapper $form = $modules->get("InputfieldForm"); $form->action = "./"; $form->method = "post"; $form->attr("id+name",'new-thought'); //create a textarea input $field = $modules->get("InputfieldTextarea"); $field->label = "Thought"; $field->attr('id+name','thought'); $field->required = 0; $form->append($field); // append the field to the form //the submit button $submit = $modules->get("InputfieldSubmit"); $submit->attr("value","Submit"); $submit->attr("id+name","submit"); $form->append($submit); //render the form echo $form->render(); ?>
  7. Here is an example for how to create the "thoughts pages". Let's say we have all our thoughts as child pages of a "thoughts" page, and that they will have a template name "thought". home -- one page -- another page -- thoughts ---- my first thought (template: "thought") ---- one more thought ---- ... --admin Create a "new thoughts" custom page in the admin (follow the instructions in the module), and paste this to it's template: <?php if($input->post->thought) { $thought = new Page(); $thought->parent = $pages->get("/thoughts/"); $thought->template = "thought"; $thought->name = time(); // page name can be a timestamp, this will make it unique $thought->title = substr($input->post->thought, 0, 30); // let's make the title match the first 30 characters of the thought $thought->body = $input->post->thought; $thought->save(); // confirmation message with link to edit the new thought echo "<p>A new thought was created. Edit it <a href='{$config->urls->admin}page/edit/?id={$tweet->id}'>here</a>.<br>Create a new one?"; }?> <h2>Write a new thought</h2> <form action="" method="post"> <textarea name="thought" rows="4" cols="50"></textarea><br> <input type="submit" value="Send"> </form> What version of PW are you using? Edit: thanks for the edit Pete, I forgot that detail
  8. @daniel.s, this is not a good case to use repeaters as the number can grow to the point of not being practical at all. Pages is the way to go. @BeardedCanadian (great name ) the way around the two step page creation is to create a new system for making these new pages. You can easily create new pages with the API http://processwire.com/talk/topic/352-creating-pages-via-api/. So, the only thing you need is to a new page where you put a form with the needed fields for your thoughts/quotes/links and use the API to create the pages instantly. If you want these pages in the admin, have a look at my Admin Custom Pages module http://modules.processwire.com/modules/process-admin-custom-pages/. edit: and welcome to the forums both of you!
  9. Just stumbled on this http://scrollback.io/. Could be a nice solution to bring the IRC channel to the forum.
  10. Ok, maybe I misread your question. There is one thing that I didn't answer. You can hide these pages from editor by putting them as children of a page under the "admin" page. They will also be hidden from searches, but if you call them like this: -admin --datapages (id:123) ----somedata ----moredata $pages->get(123)->find("selector")
  11. Hi Emmanuel, its's very easy to convert data to PW if you start thinking in tree instead of table structure. Let's say json/mongo vs mySQL/excel. One important thing to have in mind is that besides the parent child structure you have also the possibility to connect the branches of the tree with page fields, which makes it very flexible. I think the best way to structure data is to convert 1 to 1 relations as parent/child connection, and 1 to many relations as page field connections. When you query the database with PW, the "pages" are stored in a pageArray object. Obviously, if you have lots of data, this will empty your memory very quickly. That's why you should always limit your queries ("limit=50") and paginate the results when needed.
  12. I don't think there is any disadvantage besides the upgrading.
  13. Only under the same parent.
  14. Welcome to PW purwa! Make sure you read kongondo's new bible http://processwire.com/talk/topic/3691-tutorial-a-quick-guide-to-processwire-for-those-transitioning-from-modx/
  15. You would need a script for sure for importing data. But you have to divide the task in three: 1. Build the "site theme" in processwire. This is not more than identifying all the different pages on the website, divide their html by templates and replace the dynamic parts. 2. Mirror the website structure in the PW tree. 3. import the previous content to the new site. Your site seems to follow a very simple structure (not too different from the default PW website, so you can take some ideas from there), I would say 5 templates maximum: Home, basic-page, blog, contact, site-map. Header and footer would be the same in all templates, being that home would have a subheader (very easy since that one just follows the header in the markup). basic-template would need only two fields: body and headline and and title (this is for mirroring the website as is, although with processwire you could actually make the content richer by creating more specific templates. But let's stick to mirroring the website for demonstration purpose). The structure could be something like: Home (render "Poland" page) -- Poland (headline: Poland Explorer Travel and Tourist Guide) ---- About Poland Explorer ---- How to use Poland Explorer ---- ... -- Provinces (headline: Provinces of Poland) ---- Poland Explorer Travel and Tourist Guide ---- About Poland Explorer ---- ... -- Geography (headline: Geography of Poland) ---- Map of Poland ---- Mountains of Poland ---- ... -- History (headline: History of Poland) ---- Heads of State of Poland ---- Katyn Forest Massacre ---- ... -- Other Activities ---- Aviation ---- ... -- Blog ---- Article 1 ---- Article 2 ---- ... -- Contact&Search -- Sitemap (hidden from navigation) The basic template would be something like this: <? php include('head.inc'); php include('sidebar.inc'); echo $page->headline; echo $page->body; php include('footer.inc'); Yes, that simple! sidebar.inc would be something like: <div class="column fourcol"> <?php include('search.inc'); <h4><?php echo $page->headline; ?></h4> </div> <div class="widget widget_nav_menu"> <ul id="menu-provinces-of-poland" class="menu"> <?php $children = $page->children->count ? $page->children : $page->siblings; foreach($children as $c) { echo "<li><a href='{$c->url}'>$c->highlight</></li>" } ?> </ul> </div> ...and so on. There are plenty of examples in the default site that would fit very well in practically all problems you would find. The importing part is well covered in Ryan's post that was linked above.
  16. My suggestion is to use the last LTS (long term support) version of Ubuntu, right now is 12.04. The documentation in Linode is very good, follow along with their "Getting started" tutorial and you should be fine.
  17. I think there's not a ready solution. What you could do to overcome your problem is actually not that complicated, and it would only add one step to the process. Instead of storing the image page on a page field, just pull the image to a image field in the "user" page and delete the other page.
  18. I did this already and the method that I used was having the images on their own page instead of on the user page (images were avatars for users) and having a page field on the user page to link to the image. This was more or less the process (by memory): First Ajax call for the image creates a image page under the "images" page in the tree and returns the id of the newly created page. The returned id is stored on a hidden field with javascript and sent back to the server with the rest of the form on submission. While processing the form in the server, the previously created image page is stored in the page field of the new user page.
  19. field_page=0 will return also all the pages that don't even have this field i their template. The correct way to return pages with an empty page field is field_page.count=0. Unfortunately there is no way of combining field_page.count=0 and field_page=123 in one selector, so you would have to create two different arrays, and merge them. You can do this with $a->import $myPages = $pages->find("field_page.count=0")->import($pages->find("field_page=123")); After this you will have an array with all the desired results and you can even sort it as you would in a selector: $myPages->sort("created"); Edit: Pete, i just saw your answer. I don't think that it works for page fields...
  20. Well, I see two in your picture, which one is Martijn and which one is Geerts?
×
×
  • Create New...