Jump to content

kongondo

PW-Moderators
  • Posts

    7,529
  • Joined

  • Last visited

  • Days Won

    160

Everything posted by kongondo

  1. Or even... $pages->find("template=event, has_parent!=2, status=unpublished"); http://processwire.com/api/selectors/#access_control
  2. On dev branch... echo $config->version;//returns 2.3.2 - documented here echo $config->systemVersion;//returns 3 What gives? Edit: OK, answer here for $config->systemVersion class SystemUpdater extends WireData implements Module, ConfigurableModule { public static function getModuleInfo() { return array( 'title' => __('System Updater', __FILE__), // Module Title 'summary' => __('Manages system versions and upgrades.', __FILE__), // Module Summary 'permanent' => true, 'singular' => true, 'autoload' => false, /** * This version number is important, as this updater keeps the systemVersion up with this version * */ 'version' => 3, ); } protected $configData = array( // systemVersion generally represents the DB schema version, but // can represent anything about the system that's related to the individual installation. // 0 = the first version when this module was created, should remain there. 'systemVersion' => 0, );
  3. TK3, It is very hard to debug without more information. Please post: Using the forum code utility, the code in your template file around the problem area Details of the modules you have installed (though I don't think this is the problem) If you have a test site (front-end) that we can look at, you can post a link here too In your TEST site (local not remote), turn on debug in your /site/config.php. Are there errors reported when you load the page with the empty body? Check your /site/assets/logs/errors.txt file. Any errors reported? Do you get errors/weirdness with other fields? E.g. rich text area field? What if the field is not empty, do you still see the <span> in the output/source? Are you using the default ProcessWire install or are you using some other profile? (Foundation, Bootstrap, etc.) It could be coming from some Javascript. Are you using some JS in that template file? Edit: Searching your output above Google has led me to the module ProcessHeatmap (Heatmap by Userclicks). Are you using that? See below code from here public function setOffset(){ //we assume that the $page->body is inside main layout and add a span //hidden span indicates offset left to make fluid layout handling possible $this->page->body .= '<span class="offset" style="margin:0;padding:0;position:absolute;width:0px;height:0px;"> </span>'; }
  4. Like I said, that looks strange and I have never seen it before. Could you please give us more information, e.g. are you using the default PW install? Have you made modifications to its template file(s)? How does your code around that selector ($page->body) look like? etc..
  5. Hi Zahari, I'd be very happy to assist you with any questions when you get down to doing the tutorials. I'm no expert, still learning too! . Any help you can provide to make PW better is appreciated. As usual, please feel free to start threads to ask questions, thanks.
  6. Hi TK3. Welcome to PW and the forums! That's strange. PW does not output any markup. Is that your markup? What version of PW is that? To check if your body field is empty is as simple as if ($page->body) { echo $page->body; } In a selector, to find other pages where body is not empty you can do this... $pages->find('template=sometemplate, limit=20, body!=""');
  7. My opinion as I have expressed it is that the documentation could do with more examples and to be honest there has been some real effort to improve it. I have seen that since I started here. Only the last couple of weeks new sections have been added, the last one was last week I think (about multilingual sites). So, I am not saying the documentation is "good enough" full stop. My opinion is that it is good enough to get you started. You only need to read about $page, $pages and selectors to be on your way. You also need to try out some of the tutorials. Maybe, and I restate maybe, (not you in particular) some members try to jump in too quickly to create great things with PW or try to quickly to convert a site to PW without first trying to understand the basics. I don't think that's the way to go about it. Before jumping into the CMS world, I used plain HTML. I had to learn the basics of CMS world before I could make anything with Joomla. I am not saying that is how we should all learn; we learn differently. However, in any learning process there must be an understanding of the basics. In other words, the message is please help us help you. I must apologise if I sounded elitist. I did not mean to create offence. If I did, I am sorry. I cannot speak for Diogo but knowing him, he is not elitist. In fact, I have not encountered any elitists views in these forums. In my excitement to have you relate to my experience I probably did not choose my words carefully. Like I said, I was trying to relate to my situation. I did not know much about PHP before I started using PW. Yes, I'd seen an echo here and there and knew about variables but could never code anything beyond "hello world". PW has helped me improve my PHP skills. I see myself getting better at it daily, by asking questions and trying out things. As a btw, I am in the process of helping to improve "access" to PW by writing up tutorials. You may have seen my post about it. If not, check out my rather unfinished (erm, barely begun) site. On the issue of assuming things, I think there's some misunderstanding. PW assumes (in the sense of expects) that you have some basic knowledge of HTML, CSS and PHP (very basic). Otherwise, you will not be able to use the system. The other meaning of "assume" that is being conveyed is that PW does not make decisions for you regarding how you want to structure your site or what sort of logic you want to use. It does not "assume" that it knows what you want. It does not get in your way. Rather, it lets you use its tools to create what you want, how you want. I think that is what is being said here? There are several (maybe lots?) of posts that talk and teach how to do tagging in PW. Yes, we all agree they don't jump right at you hence the suggestion to use Google to search the forums (e.g. tags site:processwire.com/talk). This is a stop-gap measure as the references to examples and the docs are improved. This takes time. Hope you have noticed that pwired has started an effort to collate useful resources, code snippets and tutorials in one post to help newbies. You do not need to go and hunt thru all the threads. If you had time, I would suggest that you actually read as many posts as you can. My experience (which may not be your way of doing things) is that I read all the forum posts when I got interested in PW and before I joined the forum. It took me several months but it also helped me lots. I bookmarked stuff and read and re-read to understand stuff. I am not saying you or others must do this; just advocating it, if you have time. The rewards outweigh the costs. Then again, I am crazy I relate to your situation. I have been in your shoes. Most of us (all of us I think) have been in your shoes. The great Soma whose fingerprints you see all over this place has been in your shoes. He's shared his experience here in the forums. He read the docs and tried and asked in the forums and read more. Look where he is now . I am trying to encourage you here not to give up . Look at Diogo, Pete, Anti, Teppo, pwired and many more. They all started from not knowing much. Diogo is a designer. Pwired started with questions, he's getting more comfortable with the system everyday. Vineet Sawant is a designer but he's coding crazy things at the moment. How? By asking and trying, breaking and mending things. What am I saying? I do not think it is a good idea to ask for help to code snippets in a PM. Why? Because if you ask a question and are answered publicly, it helps the next person. I am not saying that you shouldn't PM someone for some specific question though. But it helps us all if we can share in both your question and the answers provided. So please, do not feel as if you have been pushed out of the forums. Please, ask questions; ask lots of questions . Questions have helped us all. I mean, even Ryan himself asks questions here in the forums. Yes, he does not know everything believe it or not . As for your question about 3 random posts.....an example.. $pages->find("template=posts, limit=3, sort=random"); Please also check out the examples in the docs. They cover most of this sort of thing.. Anyway, this post is way too long and has severely digressed from the original topic, sorry. Cheers!
  8. Looking forward to this Jonathan!
  9. Sorry, too many suggestions on my part! I'm just being picky As the links grow, we will probably it would be good to divide them (if possible) according to whether they are links to tutorials or code snippets or resources. Something like this: Tutorials Topic Link 1 blah blah Description etc Code Snippets Topic link 1 etc Description etc Resources Topic link 1 etc - e.g. link to a blog, docs, etc Description etc.
  10. OK. So, maybe move your links and descriptions in post #3 to post #1 and place them right after you describe what this thread is about. Thanks Edit: In the first post (#1), also add what you say in post#5 - for members to PM useful links which you will then add to post#1
  11. Use the full editor when editing your post
  12. In an ideal world, all these links plus others should be in your first post. This saves people from scrolling searching for links down below. However, that would mean all such links contributed by others are sent to you (or a mod) to edit and include in the first post. It could end up being one long first post though. The rest of the posts below the first would be for talk, discussions, etc..
  13. Great! Thanks for setting this up. We probably want to tweak the title of the thread a bit? E.g., not everybody will understand what "tutos" are , especially those not very comfortable with English. Maybe something like "Links to PW tutorials, code snippets and resources" ? I am not good at this so will let you and others improve it
  14. I have previously raised the issue of FAQs and was rightly made aware that we do have a board for that in the forums . @pwired. If you can start a thread in the FAQ board to collate links existing tuts, code snippets that would be great. Maybe under each link have a short description of what the tut is about, etc.. Of course FAQs cannot cover each and every scenario but that's obvious . Ultimately, code examples should be in Gist (or similar) I think. Anyway, I and other members would support you for sure. Are you up for it?
  15. @Zahari, Disclaimer: This below is not meant to be a criticism...just thoughts from my experience. I came in to PW from MODX and before that Drupal/Joomla and WP, etc. I feel what you are saying. Thanks for sharing your thoughts. I agree some stuff in the docs could be improved maybe with more examples. As you acknowledge, it is a community effort and any help is appreciated. On the other hand, it would be impossible to write docs for every use case. For instance, on the issue of a lack of a "categories" system you talk about, categories are predicated to systems that use them such as WP. A Drupal person will talk of where are the nodes? What about taxonomy? A MODX guy will ask for TVs and chunks. A.....you get the point . So how do we deal with this? I like what Ryan wrote in another post about focusing on the bigger picture, not the how can I do this or that. So, instead of focusing on how can I make a photo album or how can I create a menu in PW? you focus on the bigger picture, e.g. what are the basic building blocks in PW? You will notice the docs try to focus on the bigger picture. They tell you how to use the tools, those basic building blocks ($page, $pages, selectors, templates, template files and fields mainly). If you know how to use those tools you can build anything in PW. For PW, in order to effectively use its tools, you have to know some basic PHP. In other words, before you use my tools, please read the basic manual for the tools. This is nothing more than if, include, foreach, and echo. With foreach comes arrays of course. Those will suffice in most cases. However, for those willing to learn more PHP, it unlocks yet other doors and will enable you to do more with the tools. All of a sudden you can do more than echo stuff; using the API, you can delete, add, do maths, and before you know it, you have developed a small module. In essence, PW is not a turn-key solution nor does it pretend to be. On the question of more examples, I am thinking this should be a community effort (like examples on php.net). In fact, there are many examples in the forum (community contributed). Admittedly, currently it is only a handful of members who are contributing such examples. With time this will increase, I know. Hey, look at me, I only arrived recently yet I now feel comfortable enough to "contribute". I am no genius; I just learnt what I know from reading other members' contributions and the API docs . My only concern is that some of those examples will be "lost" deep in the annals of this forum. There's been community talk of collating code snippets in one place but I haven't seen that happen yet. I don't see that as a problem at all. Yes, PW assumes you have a basic knowledge of these like I said in order to effectively use its tools. In order to use this system, you need to have that knowledge. Similarly, in order to use Joomla, the system assumes you can use a mouse and a keyboard to click point and enter data . PW does not seek to replicate what those systems do. Maybe this should be made clearer in the docs if they are not clear enough. Looking forward to those videos! <btw>Come to think of it, I have seen a couple of "once this is finished I will write a tutorial to help others..." but in many cases I am still waiting for those tutorials . I am not saying the posters are not sincere; stuff just gets in the way I suppose !</btw> OK, back to WP and why I don't use it...
  16. Hi Allan, Yes, please file a bug report and the possible solution on the profile's Github site (only possible if you have an account at Github)...or post in the profile's forum thread and/or send Ryan a PM. Github is best though. If you don't wish to create an account there, I can file the bug it on your behalf
  17. Have a read at this earlier post on page #4 of this thread. It talks about roles. Seems you can import roles actually. http://processwire.com/talk/topic/383-module-import-pages-from-csv-file/?p=10160
  18. Glad it worked.... Ye, the docs are really helpful. Have a read and ask away if you have questions.
  19. No need for a module for such a simple task IMO. Here's the code that is working for me...also borrowing from Diogo's code above . It is the whole topnav.inc amended to suit your need. foreach($pages->get($wire->config->adminRootPageID)->children("check_access=0") as $p) { if(!$p->viewable()) continue; $showItem = $user->isSuperuser() ? true : false; $info = array(); if(!$showItem) { $checkPages = $p->numChildren ? $p->children("check_access=0") : array($p); foreach($checkPages as $child) { if($child->viewable()) { $showItem = true; break; } } } if($showItem) { $class = strpos($page->path, $p->path) === 0 ? " class='on'" : ''; $title = strip_tags((string)$p->get('title|name')); $title = __($title, dirname(__FILE__) . '/default.php'); // translate from context of default.php //AMENDMENTS START HERE $pageID = 22;//in this example, I use PW Setup page id which is "22" if ($p->id == $pageID) {//if the page is the one we want an edit link to //create a new variable $href $href=$pages->get(10)->url.'?id='.$pageID;//based on Diogo's code } else { $href = $p->url;//else href is normal url } echo "\n\t\t\t\t<li><a href='{$href}'$class>$title</a></li>"; //changes made; assigned $href to be value of href='' //AMENDMENTS END HERE } } Try it. Change the value of $pageID to the id of your "settings" page. Of course, you can delete the comments I added to the code if you wish
  20. Quickest I can think (without much thought )... You can output the p->url conditionally, i.e. something like if ($p->title == "settings") { //href='output link to edit the page' } else { href='{$p->url}'//example, snipped code... } Maybe even assign href value to some variable. This is probably quick and dirty and there could be a better way. Untested and it is just an idea.. Now, very important. Do not edit /wire/templates-admin/topnac.inc. Instead, copy the templates-admin to your site folder. That way, PW will instead serve your site templates-admin instead of the wire one. It will also survive an upgrade... Edit: Corrected code
  21. HI joey. Welcome to PW and the forums! A quick one, that's because the code generating that menu at the top outuputs those pages URLs. So clicking on setup, renders setup. Clicking on access renders that...hence, clicking on your "setttings" renders that... This is the line outputting the URLs in the file topnav.inc, specifically the $p->url echo "\n\t\t\t\t<li><a href='{$p->url}'$class>$title</a></li>";
  22. @Pete: Thanks for your thoughts. @Wanze; I'll PM you later to discuss how we proceed, thanks.
  23. I meant both actually - custom tables in PW DB and in external DBs. But I see your point now that I've thought about it; you are right, that should be a different module....
×
×
  • Create New...