Leaderboard
Popular Content
Showing content with the highest reputation on 08/01/2013 in all areas
-
I'd like to add a bit to the great material that has already been posted... Journey From the "Big Three" to ProcessWire... It might seem that ProcessWire is "elitist" because it doesn't assume anything. But let me share my experiences with you, which have led me to the opposite conclusion. I came to ProcessWire from the world of Joomla (and Drupal and WordPress), where all manner of web development building blocks are set up and built ready for you to use, to make your life easier. In fact, you might say that in this way a system like Joomla is the most un-elitist system out there. It assumes you know nothing, and holds your hand through every part of building a web site. For a couple of years, this was good for me. Until one day, when I learned some JQuery and wanted to implement some new concepts, or when I read on Stack Overflow about some creative ways to make PHP do what I need, or wanted to create a unique layout for a client and needed to start from a blank slate, or wanted my user registrations to look unique, or wanted my articles to have 20 separate fields, or wanted a tagging system that looked and behaved in a particular way, or wanted to set up custom search functions for my site. Suddenly, everything about Joomla's un-elitist approach felt stifling. At every step, if I was not doing something the "Joomla way," it didn't work or was 10 extra steps to override something. When I posted about this to the Joomla leaders, I was essentially told, "You don't do it that way in Joomla." When I switched to ProcessWire, I realized that I was now free to implement any good coding ideas I discovered on my own, or discovered on Stack Overflow, or read about in various CSS, Javascript, and PHP realms. Core Assumptions... ProcessWire makes only two assumptions: first, that you have a good grasp of foundational building blocks of the web; second, that you explore the API. On the first point, the assumptions ProcessWire makes are generally the same basic assumptions that would be made if you were developing sites in "pure" PHP/HTML/CSS/Javascript. In other words, any knowledge you gain about these foundational building blocks can be immediately implemented in ProcessWire. On the second point, yes, there are system-specific API elements you need to understand. But they are designed to cleanly facilitate depth and creativity in those foundational building blocks. ProcessWire Trusts Your Intelligence and Capabilities... Put all this together and what do you have? Well, you have a situation where you can create anything you want, because you can get at the foundations of systems that exist on the web. For example, if you need a tagging system, you can learn what constitutes a tagging system. What are the core principles of tagging? Once you understand it, you can build it in ProcessWire. Not only that, but you can build it your way, with no assumptions, freely. If you come from a system like Joomla, Drupal, or WordPress, this means you may have to learn a few new ways to work. But those ways of working -- again -- go directly to the basic building blocks of the web. I know from experience that the un-elitist approach used by Joomla, Drupal, and WordPress seem to be nicer but actually turn out to be very harmful to your individual progress because they delay your exploration of these foundational building blocks. With ProcessWire, because it trusts you to use those foundational building blocks, the knowledge you gain using ProcessWire is applicable beyond ProcessWire and helps you no matter how you create web applications. Put another way, ProcessWire allows you to explore and build in the most un-elitist way possible. With that Said... After all this, there is of course some system-specific material to learn. There is the ProcessWire API, which is unique to ProcessWire. The system has been developed to get as close as possible to "pure" expression, and the syntax of ProcessWire's API calls have only what is needed to get at your data. But yes, there is API syntax to learn here, and the list of specific calls is pretty long. There are "best practices" for combining API elements. There are general goals that we all need for our web applications (galleries, tagging, user registrations, forms, etc) and somewhere there is a good combination of ProcessWire API calls to make them happen. What are those combinations? Well, usually there is more than one, because it depends on what you want to do in your application. The answer may not be pre-packaged, so you may have to hunt a bit. But I definitely agree that it would be great to have documentation of various methods (combinations of ProcessWire API calls and "pure" PHP/CSS/JS) to accomplish various goals. For that, we need what I would call "goal-oriented" documentation. I am proud to say that I am working on this right now. I have been working in silence. But discussions like this make me want to get it out there sooner. * * * I hope this helps a bit. Embrace the way ProcessWire allows you to work! Thanks, Matthew8 points
-
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!6 points
-
I've had a play with quite a few content management systems and frameworks out there and have tried my hand at teaching what I learn and sharing my pain points with others. I can relate to feeling like everyone's seen the light and they're all speaking a language you don't understand, and that can be quite frustrating. I think we all learn in different ways and some of us are example based learners while others are principle based learners. I think the most important thing is to not give up. Keep searching, keep asking, keep trying. It sounds like there's a wealth of tutorials being created by people with different learning styles and hopefully there'll be enough documentation to cover every type of learner out there Time permitting I too will be squeezing out some tutorials soon.5 points
-
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>'; }3 points
-
Zahari, not wanting to be elitist here, by the contrary. I think PW can be learnt by absolutely everyone that has the will. Better yet, all the knowledge that you get from learning PW will be useful in general and not only for working with this tool. I just think it's dangerous to start copy/pasting without understanding, and I'm not saying that you will do that, but I'm sure that lots of people will if the pieces of code are at hand... About the documentation... also not saying that it can't be better (although I really like it as it is), just that there is a concept in it. It's not that it has been left incomplete by lack of time or something. The goal of it being so small is that you can read it all in some hours and be confident that you will be ready to start right away. Truth is it worked for me and also for some others. As soon as I finished reading it, I started working with PW. And I wasn't just doing things like wondering how to change the sidebar to the left, or how to remove a link from the navigation, like I was in other CMS's that I've tested before. I was immediately building from scratch, even without being a coder. And that's priceless.3 points
-
Hi kongondo I think you and I agree on a lot of things and would be good mates at a pub! This threads exchanges have only further illuminated to me that I have a very different philosophy on how ProcessWire can best be learnt when your approaching it as a beginner. I disagree with a few things that have been said here. But Im not one to want to argue. The fact remains that someone like me finds it difficult to learn ProcessWire for the reasons I outlined. No matter. I will go ahead and do things my own way and make my own tutorials with snippets . Perhaps they will only make sense to me and a few others as it appears that Im in a minority in all of this. But thats cool Anyways, cheers guys! Still lots to learn from all of ya!3 points
-
I like that approach. I think that's something we'll probably want to offer as a config option in the future.3 points
-
In some previous posts, I demonstrated a simple proof-of-concept CRUD “application” for PW using jTable. I really wanted to use DataTables since it is older, wiser and with a huge fan base. One thing I wanted was for the CRUD system to be as simple as possible and possibly be Excel-like (more below). With DataTables plugins, you can perform stuff like inline-editing and Auto-fill. The latter works just like in Excel and allows you to quickly populate cells (quick copy). But that’s as far as it goes. Google led me to other Table management systems. Some of the front runners include jqGrid and SlickGrid. SlickGrid is nice and using virtual rendering can display millions of rows with ease. Its support for displaying data delivered on demand (Ajax/server) is minimal; it requires you to download all your data before it starts manipulating it. Someone has created an Excel-like extension for it allowing copy-pasting between SlickGrid and Excel. Awesome! But, it still didn't rock my boat completely, especially the Ajax content issue. Then I stumbled upon Handsontable, a new kid on the block that describes itself as “a minimalistic Excel-like data grid editor for HTML, JavaScript & jQuery”. Though relatively new, it is as Excel-like as you can get. You can copy-paste from/to Excel [single to multiple cells and multiple to multiple cells], use the usual shortcuts (Ctrl-A, Ctrl-X, Ctrl-C, Ctrl-V, Ctrl-Y, Ctrl-Z - i.e., undo/redo, etc., and tab navigation, etc.), use Auto-fill (vertically and horizontally), freeze cells/columns, make cells/columns read only, Right-click context menus, insert/delete rows and columns, perform inline-editing, etc. Double awesome! Handsontable (HoT) is minimalistic but comes with a rich API. However, most of the implementation is down to you (sounds familiar?). It will render the Table and provide you with Methods/Events/Options to manipulate it. You just have to provide the data as an Array or JSON defining your columns and containing your data. Soma has a DataTable module that is currently read only; you cannot edit the displayed data directly in the table. It is also in lazy development . So, I started toying with the idea of using HoT as an Excel-like CRUD system (module) for PW. I wanted something that could quickly and easily do mass editing (Batcher-like). Imagine quickly creating basic pages/records by copy-pasting from Excel. Or quickly changing records by dragging (Auto-fill) or pasting new values over old ones. Well, the result can be seen in the screencast below. I’d like to hear your thoughts whether this is something that I should consider developing into a module; something that could be used by Superusers. Depending on implementation, it could be used by other users as well. All HoT needs is data. What you do with that data is up to you (the developer) and your code! This can be very dangerous if not implemented correctly, of course! You could easily delete important records! However, HoT does not touch your database! Deletions, insertions, etc., will not alter your database unless you specifically write the PHP code to do that. All it does is send data to the server via a method your specify (post, get, Ajax, etc.), and even that is your implementation. You do not need to implement deletions or additions. You can use it for updating content only or as read only, but where’s the fun in that ? In the screencast , apart from the table itself, all the other implementations are custom - the buttons, selects, auto-save (can be tricky? can DDOS your server?). The current implementation is not perfect; it is a demo after all. Certain stuff would need to be implemented differently . I didn't want to spend too much time on something that would not be useful in the end. All CRUD operations are via PW API and/or vanilla PHP. Deleted pages are Trashed and not permanently deleted. If there is interest for a module of this kind, I would request all the help I can get to develop it please. I would put it up on Github of course. In the demo, this is running off Diogo’s ACP module. Let me hear your thoughts please. Should a module like this see the light of day? Thanks Wasn't sure in which forum to post this...2 points
-
This thread is used as a place to collect: 1. links to posts in the forum answering (repeating) newbie questions 2. links to posts in the forum and elsewhere on the net giving good insight in processwire 3. links to good articles about processwire 4. links to good tutorials posted in the forum 5. links to movie clips 6. links to posts in the forum talking about modules 7. code snippets or links to code snippets 8. Usefull Helpfiles Many good posts that answers (repeating) newbie questions or give good insight in the how and why of processwire, links to tutorial posts, (also on the net), movie clips, clarifying articles and code snippets are spread over the forum. PM me if you know a link. About this kick start see this post: http://processwire.com/talk/topic/4143-wordpress-dominates-19-of-the-web/page-2#entry40910 This is a work in progress, it takes time to make it grow bigger and better. = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = STARTING NEWBIES AND DESIGNERS Link1: Starting and growing with processwire. https://processwire.com/talk/topic/3990-another-simple-photo-gallery-tutorial/page-4#entry61069 Link2: I am basically a designer with some programming skills. My question is this: Can I go ahead to use processwire for this even though i am still learning php. http://processwire.com/talk/topic/3954-starting-out-with-website-intranet-and-internet/ Link3: Feeling overwhelmed http://processwire.com/talk/topic/3215-newbie-overwhelmed/ Link4: Questions concerning PW and it's capabilities http://processwire.com/talk/topic/1557-questions-concerning-pw-and-its-capabilities/ NEWBIES FIRST CODING QUESTIONS link1: Using a default install, I'm stepping through the tutorials, templates, etc and trying to understand the basic concepts behind processwire and at this point in time "head.inc" & "foot.inc". http://processwire.com/talk/topic/3421-footinc/ Link2: I am puzzled why some html tags are starting in head.inc but don't end in head.inc Instead they are ended in foot.inc http://processwire.com/talk/topic/3388-question-about-headinc-and-footerinc/ Link3: Question about not using ?> in processwire http://processwire.com/talk/topic/3370-question-about-missing/ Link4: After you installed processwire, it comes with a default website. What is the best way to fill in your own website ? How do you replace the default processwire website with your own ? http://processwire.com/talk/topic/3379-how-to-fill-in-your-own-website/ Link5:How much extra work/time will I have to put in, as far as understanding and writing php and getting the hang of the PW system, just to be able to create the same responsive designs I would make in HTML/CSS/Javascrip, while also achieving the easiest type of content editing capabilities (in line with what you can get with a CushyCMS type product)? http://processwire.com/talk/topic/3961-new-to-cms/ Link6: I realize what I am confused about was really something quite basic, such as where are the snippets of php code go beside on templates? Can they go on a page as the value of body field for example? http://processwire.com/talk/topic/3383-back-to-basic/ Link7: I'm stuck in something that should be very simple. http://processwire.com/talk/topic/3720-my-first-doubt-using-pw/ Link8: Several questions before I can start. http://processwire.com/talk/topic/3589-several-questions-before-i-can-start/ PROCESSWIRE CMS INSIGHTS Link1: Reading this thread makes you understand processwire real quick. http://processwire.com/talk/topic/5667-help-a-noob-get-started/ Link2: Very good case study from RayDale giving good insight in processwire http://processwire.c...a-a-case-study/ Link3: Symphony or Processwire ? Another good insight. http://getsymphony.com/discuss/thread/79645/ ARTICLES Link1: Why he choses processwire over modx http://www.mademyday.de/why-i-chose-processwire-over-modx.html COMING FROM MODX ? Link1: You've been using MODX but now you've found ProcessWire. It’s totally amazed you and you can’t wait to get started. But…you are wondering where everything is. If this is you, read on… http://processwire.c...ning-from-modx/ Link2: A MODX refugee: questions on features of ProcessWire http://processwire.com/talk/topic/3111-a-modx-refugee-questions-on-features-of-processwire/ Link3: Code comparison between modx and processwire. http://processwire.com/talk/topic/2850-processwire-for-designers/page-2#entry30349 COMING FROM DRUPAL ? Link1: How to move your site from Drupal to ProcessWire. http://processwire.c...ndpost__p__8988 PAGES IN PROCESSWIRE Link1: Understanding pages in processwire http://processwire.com/talk/topic/5667-help-a-noob-get-started/page-2#entry55820 Link2: More about the function of pages in processwire http://processwire.c...fused-by-pages/ Link3: How to hide Pages from the Topnavi via Adminmenu http://processwire.com/talk/topic/2037-how-to-hide-pages-from-the-topnavi-via-adminmenu/ TEMPLATES IN PROCESSWIRE Link1: A good post with code examples to start a template http://processwire.com/talk/topic/43-template-tutorial/ Link2: Template design a better route http://processwire.com/talk/topic/2782-template-design-better-route/ Link3: A different way of using templates http://processwire.com/talk/topic/740-a-different-way-of-using-templates-delegate-approach/ FRONT-END / BACK-END Link1: ProcessWire Setup and front-end editing made easy http://processwire.com/talk/topic/2382-processwire-setup-and-front-end-editing-made-easy/ Link2: Creating a front-end admin http://processwire.com/talk/topic/2937-creating-a-front-end-admin/ Link3: How would I build functionality and write information from the front-end to the back-end? http://processwire.com/talk/topic/2174-writing-from-front-end-to-back-end/ Link4: Is it possible to create a custom login page like a template ? http://processwire.com/talk/topic/107-custom-login/ Link5: A "members-only" section in the front-end. Integrating a member / visitor login form http://processwire.com/talk/topic/1716-integrating-a-member-visitor-login-form/ Link6: Trouble deleting pages from the front-end. http://processwire.com/talk/topic/2290-trouble-deleting-pages-from-the-frontend/ MODULE Front-end Edit. It turns the content of $page->body into a clickable area and gives the ability to frontend edit the content via tinyMCE http://processwire.com/talk/topic/3210-module-frontend-edit https://github.com/Luis85/PageInlineEdit/ MODULE Fredi, friendly frontend editing. http://processwire.com/talk/topic/3265-fredi-friendly-frontend-editing/?hl=fredi http://modules.processwire.com/modules/fredi/ MODULE Admin-bar Provides easy front-end admin bar for editing page content in ProcessWire 2.1+. http://processwire.com/talk/topic/44-is-there-way-to-get-information-about-current-user-in-templates/ http://processwire.com/talk/topic/50-adminbar/ http://modules.processwire.com/modules/admin-bar/ MULTI LANGUAGE WEBSITE IN PROCESSWIRE Link1: Multi-language website page names / URLs http://processwire.com/talk/topic/2979-multi-language-page-names-urls/ Link2: API http://processwire.com/api/multi-language-support/multi-language-urls/ Link3: The name of the default language can't be changed in Pw, but the title. http://processwire.com/talk/topic/4145-recoverable-fatal-error/#entry40611 ADD NEW USER TO YOUR WEBSITE AND PASSWORD RESET Link1: Integrating a member / visitor login form http://processwire.com/talk/topic/1716-integrating-a-member-visitor-login-form/?hl=%2Bpassword+%2Breset#entry15894 Module http://processwire.com/talk/topic/2145-module-send-user-credentials/?hl=%2Bpassword+%2Breset BASIC TUTORIALS FOR NEWBIES Link1: Approaches to categorising site content http://processwire.com/talk/topic/3579-tutorial-approaches-to-categorising-site-content/ CODE SNIPPETS AND FUNCTIONS Link1: Get page id from images object https://processwire.com/talk/topic/6176-get-page-id-from-images-object/ Link2: Function to render Bootstrap 3 carousel markup from ProcessWire images object https://gist.github.com/gebeer/11200288 .HTACCESS EXAMPLES ON YOUR HOSTING SERVER Example1: A working .htaccess file. The issues were that the .htaccess file must exist on the server before installing processwire and that the server did not allow options in the .htaccess file. After fixing that processwire could be installed on the server without any problem. Note that such restrictions might be different on your server that you need to find in the faq of your host. RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,NC] HTML KICKSTARTER Link1: How can i integrate HTML Kickstarter with processwire? http://processwire.com/talk/topic/2731-how-can-i-integrate-html-kickstarter-with-processwire/ MOVIE CLIPS Field dependencies are coming in ProcessWire 2.4. Field dependencies are basically just a way of saying that one field depends on another. It dictates which fields should be shown in a given context. https://www.youtube.com/watch?feature=player_embedded&v=hqLs9YNYKMM HELP FILES Cheatsheet Link1 Cheatsheet 1.1 as pdf file Download: http://processwire.com/talk/index.php?app=core&module=attach§ion=attach&attach_id=1299 Link2 Cheatsheet is now a processwire site (great work by Soma) http://cheatsheet.processwire.com/pages/built-in-methods-reference/pages-find-selector/ INTERVIEWS Link1: About the history and coming to be of processwire http://processwire.com/talk/topic/4084-about-ryan-and-processwire-an-interview-with-ryan-cramer/2 points
-
Problem is that you search only published pages. Try adding include=all to your selector, this will also give you unpublished pages.2 points
-
thank you a lot, wanze. i'am watching this community since february this year. its a pleasure for me to be part of such a lovely, decent and productive community - so i will do my part to it, too. also thank you for your help. you're right, my variable is the problem. i like such problems, because they are the base of my education. i'am autodidact - learning by doing, you know. for this time, you're my php-coach. thanks a lot. originally i'am lifeguard. since 2008 i run a little web&marketing-agency, because culture becomes canceled in germany more than more. till february, i worked with joomla as my working-base. php never was something i want to learn more than necessary. but in fact, i had to. joomla did the job, virtually. but its joomla, you know. now, since i found pw & its fantastic sources (also forums etc.), php & me still getting friends. I never thought that it could be so easy to be so flexible. :] for me, pw is not only cmf/cms. pw is an attitude. thanks to ryan & the pw-community! and thank you wanze. ;] best regards from the land of 'Plan B'. peace!2 points
-
I know you won't resist to look here one more time, so I will answer Might be that I'm working with PW and in this forum for too long, and am overlooking some difficulties that people might have. So other approaches to make people feel at home are welcomed for sure. As for the official Docs, and for the way PW works (where some things have to inevitably be assumed), choices have to be made, and those belong to Ryan with the help of us all (so, keep proposing). I can't help to be a bit sad that you interpreted mine, and others, responses like this. Again, we are talking about the official docs. How can you write documentation without deciding how you want people to learn? When you teach, you are always deciding how others will learn... and tough choices have to be made.2 points
-
Hi autobahn and welcome! I think you have a PHP (logic) problem. You must initialize your $timesheet_item_list variable before the foreach loop, otherwise PHP doesn't know it afterwards (Scope). Also you want to append the output of each loop to that variable. // Initialize $timesheet_item_list = ''; foreach ($page->timesheets as $timesheet_item){ $timesheet_item_list .= '<li class="clr_fx">....'; // Note the dot before '=' // ... }2 points
-
Is anyone here a heavy bookmarker like I am? Typically I'll get most of my news from Hacker News and Slashdot, followed by some great blogs on a daily basis. I usually never have time to read an article in depth when I first come across it, so I'll bookmark it for later. Or, if I quickly need to get up to date on some topic, I'll do a search (usually by tags) and familiarize myself with important stuff I've bookmarked in the past. After having used browser native based bookmarking (Firefox and Chrome), then Delicious, then Diigo, then Pinboard and becoming frustrated by all of them for various reasons and limitations, I've decided to roll my own little single user (and non social) bookmarking system with ProcessWire (with Bootstrap 3 as the frontend framework). It's still a work in progress, but it takes the best of all those systems with my own power features. It also utilizes ajax for certain actions. I'll need to create a Chrome extension to tie it all together. I have to say however, after working non-stop on it for hours on end and not being able to think of anything else, it's looking slick. Damn you ProcessWire for making this so enjoyable. Jonathan1 point
-
This looks awesome, loved watching the video. Just let me know if there's anything I can do to support further development of this.1 point
-
While I've not had to do it before, I think you can approximate a limit=1 (for pagination purposes) just by specifying a "start" value based on the page number: $item = $pages->find("limit=2, start=" . ($input->pageNum-1))->first(); The resulting $item would be the one you'd output on this pagination.1 point
-
It's whichever version is under the Dev branch on Github - the verisons in the readme or anywhere else in the Dev branch are irrelevant. The point about the Dev branch on Github is that it will always contain the very latest code regardless of whether a version number has changed or not - if ryan changed the version number every time he committed a batch of new code we'd be on version 2.3.712 as he has uploaded something new to the dev branch 712 separate times since v2.3 was created (or maybe since 2.2... can't remember if this was a new Git repo for 2.2 or 2.3). These might be a few updated files or just a single line of code, but every time new code is pushed to Github it's a separate "commit". Long story short, version numbers don't change with every commit to Github - they change when those commits are merged with the stable (Master on Github) branch. The dev version isn't really mentioned on the PW site itself as it's for developers who wish to tinker and other curious parties and is not generally recommended for live sites - it's "beta" really, at least the changes are - but some of us can't help ourselves1 point
-
Thanks, I understand now. I've updated the InputfieldCKEditor to populate the config.height property based on the rows value.1 point
-
In both branches the readme.md says 2.3. You can just install the zip and check in the footer of the admin which is supposed to say 2.3.2. You can also check the system version by running this code: echo $config->version; or echo $config->systemVersion; Like I said: I checked and the zip is the latest dev. No need to worry mate1 point
-
I think I've been relying on pen and paper too much and need to look up a lot of these1 point
-
That's quite a list MarcC! Thanks for sharing I haven't really found any mind mapping software that works well for me yet so I'll give freemind a go. nvALT looks interesting too.1 point
-
Greetings, Funny you ask this, because I have recently been thinking about how complex my bookmarks have become in Firefox. I am always organizing them. It's worth the effort, but I would be glad to hear about systems people use to better organize and use their bookmarks! Below is a screen shot of my bookmark folders in Firefox, which are arranged alphabetically. Sorry, the shot gets cut off at "u"! And this doesn't even show all the sub-folders! Thanks, Matthew1 point
-
http://processwire.com/talk/topic/1036-markupsimplenavigation/?p=228871 point
-
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!=""');1 point
-
Just some thoughts: - but why can't they be real PW-users too? - You can create a specific role for them if you have other users (that not belong to the intranet) too. - You may create only one real user in PW, e.g. called 'intranet', and if the intranet-script returns valid user, you load/select this dummy-user. The real username you can store in $session. At least you are a bit rare with informations what the users should / need to do in PW, need they to be unique, do they need different roles / rights, or what else?1 point
-
Yes, commenting out the 2 save lines will work. I'll take an extra look at the empty fields. Time zone settings are quite important for this module, but would only cause to publish/unpublish pages at the wrong time, but not more than 27 hours off (GMT-12 all the way to GMT+14 + possibly DST) As for the $time variable, that could be an issue. I'll change the variable name to something more unique in the next update. Update: uploaded a new version where: 1. $time has been replaced with $currenttime 2. Added language support for the whole module. /Jasper1 point
-
This doesn't have anything to do with permissions, since you don't want to use the admin. The process for this is triggering the PHP code, usually by submitting a form. Here is a very simple example: <?php // on the top of the template file, before any code that echoes content if($input->post->submit){ $title = $sanitizer->text($input->post->title); $p = new Page(); $p->template = $templates->get("basic-page"); $p->parent = $pages->get(1); $p->title = $title; $p->save(); } ?> <!-- later on, echo this form --> <form name="input" method="post"> title: <input type="title" name="title"> <input type="submit" value="Submit" name="submit"> </form>1 point
-
I am sure that it is a line of debug code that diogo was using to check those paths. Note the: //exit on the next line. If you uncomment that, then the echo line will show the from and to paths which are about to be copied. In other words, that line does nothing and the || are just his means of separating the two paths - nothing to do with the PHP "OR" operator.1 point
-
Hi hafa and owzim I haven't been on here in a while as my work commitments were with things other than web development. I have been asked to once again look into migrating our company's old site to something new (which will very likely be ProcessWire with the Twig templates) so I will be looking at this again. I haven't yet tried the module with the latest build of ProcessWire but unless Ryan has made some major changes to things I can't imagine there being an issue. I will of course test it properly when I get to working on the site and make any updates if necessary. As for it's interaction with the cache I admit I am not sure. Twig caches itself to "raw" PHP code, which I believe has quite good performance, but beyond that I have not tried anything. Let me know if there is anything more you'd like to know and assuming my work priorities don't get shifted on me again I will hopefully be able to look into it1 point
-
1 point
-
Fans of both modx and pw ? How many people would that be ? There are lots of modx refugees here. To me it is more that there are lots of ex modx-ers who moved over to pw for 3 main reasons: 1. modx evo roadmap first stopped, was then spread over forks and later on picked up again but by then pw was already discovered. 2. for many evo users revo was not the answer. 3. revo is too slow and suffers scalability (disclaimer on this third one, this is my opinion - try it your self) pw is the cms with a core, architecture, and performance many of us have been looking for. The modx forum is as great as the pw forum. I learned a lot during my evo days thanks to a lot of great people in the modx forum who always help you out in a professional way such as giants like Susan Otwell (19000 posts!!) and Bob Ray, Open Geek, etc. etc. and Mary with dozens of tutos.1 point
-
Okay, so here's what I came up with: Goal: Make a branch of pages in the Home tree completely hidden from a "client" role, say of Menus or Sidebars, but that is visible from a tab in the admin's primary menu so that the client is just dealing with pages in the "Home" tree. The end result being just "Pages," "Menus," and "Sidebars" in the primary admin menu. Steps: 1) I make a template called "node" for any parent page that starts a branch of pages that shouldn't be viewable in the Home tree to the client role. This isn't necessary but I feel like it's helpful because now these pages don't resemble the regular page template if the user somehow stumbles upon them. 2) I make a page called "Menus" and assign it the "node" template in the Home tree. All my custom menus are children of this page. 3) I make a page called "Menus" as a child of the hidden Admin page in the Home tree. This causes PW to make a tab with the message about not having a process assigned to it. 4) I make a module that assigns a process to the new template: (http://processwire.com/talk/topic/1272-new-page-nav-in-admin/): class UtilityMenuList extends Process { public static function getModuleInfo() { return array( 'title' => 'Custom Menu List', 'summary' => 'List all custom menus.', 'version' => 100, 'permission' => 'page-edit' ); } public function execute(){ $pl = $this->modules->get("ProcessPageList"); $pl->set('id',1057); // or any other parent page return $pl->execute(); } } Here we set the ID to the "Menus" page from step 2. This is the branch of pages we want to appear on the Menus tab. 5) We go back to the Menus admin page from step 4 and choose UtilityMenuList from the Process field. This makes PW show a Home tree that only includes the Menus branch. 6) Now we want to exclude the Menus branch from being visible on the Home tree, since that should only show "regular" Pages. I followed Soma's tutorial here for extracting branches from the JSON, since it's not apparent how to hook into ProcessPageList according to this thread: http://processwire.com/talk/topic/1272-new-page-nav-in-admin/. We create another module: <?php /** * Utility Hide Nodes * * Hides pages with a node template from display in the admin. * * ProcessWire 2.x * Copyright © 2010 by Ryan Cramer * Licensed under GNU/GPL v2, see LICENSE.TXT * * http://www.processwire.com * http://www.ryancramer.com * */ class UtilityHideNodes extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Hide Node Pages', 'version' => 100, 'summary' => 'Example module to hide page in the admin per user per page. Add a page field "pagelist_hidden" with a PageListSelectMultiple input type to the user template. Select or add pages you want to hide in the admin.', 'href' => '', 'singular' => true, 'autoload' => true ); } public function init() { // only add hook only if the render parameter is set // (as used by ProcessPageList) if(!isset($_GET['render'])) return; $user = $this->user; $roles = $user->roles; // loop thru each role foreach($roles as $role) { if (!$role->pagelist_hidden) return; } $this->addHookAfter('ProcessPageList::execute', $this, 'pageListHiddenPages'); } public function pageListHiddenPages(HookEvent $event){ $user = $this->user; $roles = $user->roles; foreach($roles as $role) { foreach($role->pagelist_hidden as $hidden_page) { $hidden[] = $hidden_page->id; } } // make sure it's an ajax request if($this->config->ajax){ // manipulate the json returned and remove any pages found from array $json = json_decode($event->return, true); foreach($json['children'] as $key => $child){ if(in_array($child['id'],$hidden)) unset($json['children'][$key]); } $json['children'] = array_values($json['children']); $event->return = json_encode($json); } } } 7) I altered Soma's code to make it work with roles. We go to the Role template instead of User and add a new field called "pagelist_hidden" of the type Pages, with the following settings: Details = Multiple Pages (PageArray) and InputFieldType = PageListSelectMultiple. This will let us choose specific pages to make hidden from the Home tree on a role-by-role basis. 8) In my case I have a "client" role, so I assign this field to the Role template and then pick my Menus branch on the "client" role. 9) If I log in as the client role, the Menus branch doesn't appear at all in the Home tree, but I can still see it in the branch that gets outputted under my new Menu tab. So as a result we can add as many tabs as we need (potentially to create the illusion of more content types beyond pages) and hide as many branches thru the admin interface by simply adding them to the client's user role. The Menus parent page still appears on this tab, which is unfortunate but not so bad. If this were a Blog section, it would still make sense visually. I just set the parent to be uneditable, that way the client can't mess with it, but the children are still editable. Next step would be... can we somehow paginate a branch? Anyhoo it's pretty neat so far. Edit: Altered Soma's code to work with roles & not individual users.1 point
-
Wow, you guys are truly great. Thanks for your patience. It's all solved now. I can't believe how easy it all is now. I was basically starting with an older technique, switched to the new one, and there was still all kinds of legacy code here and there. Strange redirects, 404s etc. Remember that I owe you a beer if you should ever come to this neck of the woods...1 point
-
Just today I relaunched http://barefigur.es/ It’s now powered by ProcessWire. A bit of history: I launched Bare Figures in January 2012. Originally it’s a site for visualizing Apple’s quarterly results. Charts are being rendered by Highcharts JS. In the first few months after the original release I did all manually (actually also creating the JSON file by hand). After that I used a bare-bones SQL database for inputting the data and a PHP script generated the JSON file to feed Highcharts. Now Bare Figures is powered by ProcessWire (and it feels just absolutely right, I love it). I created a module that generates the JSON files and now the site is, of course, also scalable, which means I can add more companies to the site (the first one besides Apple is Google). I plan to add many more in the future. What do you think?1 point
-
You do realize that the section this question is posted in is called: So this already seems like a fit 'channel' for these types of questions. Maybe it could be managed better, i don't know, but that's also a lot of work. I agree that some sort of FAQ for beginners could be a useful resource.1 point
-
1 point
-
This is really awesome! Never heard of this plugin before. I'm thinking of integrating Handsontable into Batcher, there are some other feature requests pending I wanted to integrate sooner or later. Kongondo, are you already developing a separate module? What do you think? Cheers1 point
-
Love it I was about to say that it wouldn't work for my idea in the other thread where I was talking about using something like this for repeater fields, but then I just saw the cell types on offer here and my jaw hit the flaw: http://handsontable.com/demo/renderers.html What impresses me with the cell types is that the config data for select fields, checkboxes, datepickers and autocompletes etc can be read straight from your field's config data in PW so there is almost certainly a way of making that happen if I ever find the time. So many possibilities here, and I love what you've done so far!1 point
-
Welcome! That's a really good & interesting question. One thing I'd suggest is to read this article and Ryan's comments below it: http://gadgetopia.com/post/7242 He talks about "bucket" CMS software, which is really part of what you're talking about, if I'm reading you right. So read what he says about how he prefers to arrange data and see what you think. It could be that you end up writing a really neat system on top of ProcessWire, and I've actually spoken about other CMS developers on that subject, but I think it's a good idea to understand ProcessWire's aims & successes first. I'll hold off on admin tab advice because it's been a while since I've done that and my knowledge may be outdated.1 point
-
Hi kongondo, This is awesome! I would love to see a filter for the table that would accept a standard PW Selector rather than just a drop down for Templates. That would allow you to combine multiple templates in a result set, or get as granular as you need in terms of searching large data sets. Great work!1 point
-
Hello all, So I've been asking way too many stupid questions on forum to turn an idea into reality. I've finally launched a basic version of the drama booking website. Still many important things like Payment & sms gateway are remaining but that too will be added soon. Allow me to present you Ticketees.com (Credits: http://ticketees.com/humans.txt) It's been out & being tested and used by drama producers for almost a week now. We've got some very positive response. It wouldn't have been possible if I hadn't learnt so much from Ryan & ProcessWire's community and ofcourse, ProcessWire itself. I've very very thankful to each & everyone who made it possible. There's a long way to go, many many things are left to be done. I'd like you all to see and give me your honest feedback, good or bad, help me improve it. Thank you all once again.1 point
-
Hi, installation process asking for DB name and did not create any new database. Database must be created before PW instalation. So if you want two PW aplications, create two databases with different names and during instalation process choose what BD you want to use. Seems to me like you were owerwrited content of your one DB.1 point
-
The way you do it is to first add a new integer field to your 'brand' template. Call it something like 'num_products'. You might choose to make it hidden, so that it doesn't appear in the editor (if you prefer that). Next edit your /site/templates/admin.php and add this above the include() line that's already there: $pages->addHook('saveReady', null, 'updateBrandQuantities'); function updateBrandQuantities($event) { $page = $event->arguments(0); if($page->template == 'brand') { // a 'brand' page is being saved $page->num_products = wire('pages')->count("template=product, brands=$page"); } else if($page->template == 'product' && $page->isChanged('brands')) { // a 'product' page is being saved and 'brands' changed foreach($page->brands as $brand) $brand->save(); } } The trick is that if you already have a populated site, then you have to establish the quantities for the first time by saving all the 'brand' pages. You could temporarily add this code to one of your site's template files and view the page to populate them. After that, remove the code as it would no longer be needed. foreach($pages->find("template=brand") as $brand) { $brand->save(); }1 point
-
I would say that the blog profile is not the best place to start. It uses more advanced techniques and was designed to be a demonstration of them– These are techniques I don't even use in my own site development, but felt like we needed a profile that would appeal to those looking for a dedicated MVC strategy. The best place to start really is the basic profile that comes with ProcessWire. When you understand that, you really can build anything. If you are wanting to go further, you might like to look at the skyscrapers profile. But the important thing to remember is that there is no "right" way to build your site in PW. This is why even tutorials can be a mixed blessing when you are learning, because they reflect one approach that may not necessary be the right one for you. Beyond the basic profile, you just need to read $page, $pages, PageArray and about Template files. Ignore everything else, because you may never need it. Don't feel like you need to remember or understand everything on those pages. But read through them and make note of what's there. These pages cover 99% of what you will do in ProcessWire from the code side… and probably a lot you won't ever use too. Once you get going and developing stuff, you'll want to keep the Cheatsheet open, which has sections that cover what's on those links above more succinctly. In ProcessWire, you should be comfortable with HTML markup and CSS. But it's less important that you know PHP. You only need to learn a few basics. You really don't need to know any more than you need to know EE tags. Know how to get in and out of PHP from HTML markup. i.e. <?php ... ?> Know what a $variable is – just a place to store a value. Most ProcessWire API functions return a value. Know how to use an if() statement. In PW, you'd use an if() to test if something had a value you wanted to output. Know how to use a foreach(). In PW, you'd use a foreach() to cycle through a page's children, or the results of a $pages->find(...). Know how to output a value, whether: <?php echo $value; ?> or <?=$value?> …both do the same thing. Know how to use include() to include another file, i.e. "<?php include("./header.inc"); ?> I think that covers all you would have to know to do most things from the PHP side in ProcessWire. Can anyone think of anything major I'm missing? Lastly, when you are developing, enable debug mode in /site/config.php: $config->debug = true; This will ensure that you get helpful error messages rather than ambiguous ones.1 point
-
I haven't given up on this, and I came quite far. It's been a couple of months since I worked on it - last couple of months have been kind of hectic for me, so I haven't made any recent progress. I do want to work on this, and still believe it's possible - since I gave up on using $trackChanges, the approach I'm using should be pretty safe. Probably a couple of weeks of work left on this at least though, and not sure when I'll get back to it...1 point
-
Maybe something like this then, extending from Soma's example: $titles = array('first', 'second', 'third');foreach($titles as $title) { $np = new Page(); $np->parent = '/path/to/your/parent/page/'; $np->template = 'basic-page'; $np->title = $title; $np->save();} So there's no need for WireArray or PageArray here, nor import() - which has nothing to do with creating new pages but importing Page objects into a PageArray. And if you'd want to import some more data in there at once, take at look at this as well: http://modules.processwire.com/modules/import-pages-csv/1 point
-
You can go to PW's unofficial complementary documents for this http://php.net/manual/en/function.date.php1 point
-
Here's some PW (Dictator) tag stuff from the past. Stillmovingdesign mentioned CSS classes, so thought maybe some would be interesting. Dictator CMS (the one before PW) used tags like this for images, except that each image could be assigned a tag directly in the editor. Then you would type the tag (like "image" for example) in any text field like this: {image} If multiple images had the same tag, it would display all of them. Any image could have multiple tags too. If you wanted to assign a CSS, class, you'd do it like this: {image}.class So you could create a CSS class like "left" and "right", and display an image like this {image}.left If you wanted to grab an image from another page, you'd do this: {/some/other/page:image} You could actually do the above with any field. So if you wanted to display the 'body' field from some other page, you could use this tag: {/some/other/page:body} While I'm less keen on tags nowadays, I actually kind of miss enabling an editor to use tags like this in their text fields. So am glad to see Diogo's module as a step in that direction. If people like being able to do this, we could always bring back some of the older tag options like above.1 point
-
That's my code. I always use jquery for instant registration without refreshing page, so my code is composed of 3 parts. The html form, the javascript that performs the validation (also check if username and email are already used) and the php that performs registration process. After registration user will redirect to profile page with welcome message. There are some code lines you probably don't need but you can easily clean...simple php. Note: because of jquery you cannot have the php code inside PW folders so i have an external folder called "process" with all my php files called by jquery at the same level of "site" folder, in this case "/process/register.php". P.S.: i'm using jquery validate plugin for validation. FORM <script type="text/javascript" src="/site/templates/scripts/register.js"></script> <div class="row"> <div class="span16"> <fieldset> <legend></legend> <form action='/iscrizione/' method='post' id="registerform"> <div class="clearfix"><label for="login_name">Username</label><div class="input"><input type="text" id="login_name" name="login_name" value="" maxlength="50" /></div></div> <div class="clearfix"><label for="login_pass">Password</label><div class="input"><input type="password" id="login_pass" name="login_pass" value="" /></div></div> <div class="clearfix"><label for="confirm_pass">Ripeti password</label><div class="input"><input type="password" name="confirm_pass" value="" /></div></div> <div class="clearfix"><label for="email">Email</label><div class="input"><input type="text" name="email" id="email" value="" maxlength="40" /></div></div> <div class="actions"> <input type="submit" value="Iscriviti" class="btn primary" name="register_submit" id="register_submit" /> </div> </form> </fieldset> </div> </div> JS $(document).ready(function(){ $("#registerform").validate({ debug: false, rules: { login_name: { required: true, minlength: 6, remote: "/process/username.php" }, login_pass: { required: true, minlength: 6 }, confirm_pass: { required: true, minlength: 6, equalTo: "#login_pass" }, email: { required: true, email: true, remote: "/process/emails.php" } }, messages: { login_name: { required: "Inserisci il tuo username", minlength: jQuery.format("Inserisci almeno {0} caratteri"), remote: jQuery.validator.format("Lo username {0} non è disponibile.") }, login_pass: { required: "Inserisci la password", minlength: jQuery.format("Inserisci almeno {0} caratteri") }, confirm_pass: { required: "Ripeti la password", minlength: jQuery.format("Inserisci almeno {0} caratteri"), equalTo: "Le password non sono uguali" }, email: { required: true, email: "Inserisci una email valida", remote: jQuery.validator.format("Questa email è già presente nel nostro database.") }, }, submitHandler: function(form) { $("#register_submit").attr('value','Attendi...'); $("#register_submit").attr('disabled', 'disabled'); $.post('/process/register.php', $("#registerform").serialize(), function(data) { if (data=='success'){ var url = "/mioprofilo/"; $(location).attr('href',url); }else{ $(".span16").prepend( $(data).hide().fadeIn('slow') ); $(".error").fadeOut(5000); $("#register_submit").attr('value','Iscriviti'); $("#register_submit").removeAttr('disabled'); } }); } }); }); PHP <?php require_once('../index.php'); require_once('class.tempmail.php'); $input = wire('input'); $sanitizer = wire('sanitizer'); $roles = wire('roles'); if($input->post->register_submit) { $username = $sanitizer->username($input->post->login_name); $pass = $input->post->login_pass; $email = $sanitizer->email($input->post->email); $u = new User(); $u->name = $username; $u->pass = $pass; $u->email = $email; $u->roles->add($roles->get("guest")); $u->roles->add($roles->get("utente-basic")); // my custom role $u->save(); // i add profile picture to every user after registration using 5 different random avatar images. $pnum = rand(0,5); $profilephoto = wire('config')->paths->root."site/templates/styles/images/noprofile".$pnum.".jpg"; $u->profilephoto->add($profilephoto); $u->profilethumb->add($profilephoto); $u->save(); if (wire('session')->login($username, $pass)){ $array_content[]=array("username", $username); $array_content[]=array("login", $username); $array_content[]=array("password", $pass); $admin_id = "noreply@domain.com"; $user_email = $email; sendingemail_phpmailer($array_content, "register.html","class.phpmailer.php","Sitename",$admin_id,$user_email,"Welcome to website"); print "success"; }else{ print '<div class="alert-message error"> <p>Errore durante la registrazione. Riprova.</p> </div>'; } } ?> Code for checking the existing email (or username, same code, just change variable) <?php require_once('../index.php'); $email = trim(strtolower($_REQUEST['email'])); $sql_check=wire('users')->find("email=$email"); if($sql_check<>""){ echo 'false'; }else{ echo 'true'; } ?> And that's the login HTML FORM <?php if ($session->get("_user_id")){ $session->redirect('/'); } ?> <? include('./head.inc'); ?> <div class="topbar"> <div class="fill"> <div class="container"> <h3><a href="/">Sitename</a></h3> <ul class="nav"> <li class="active"><a href="/">Login</a></li> </ul> </div> </div> </div> <br><br><br> <script type="text/javascript" src="/site/templates/scripts/login.js"></script> <div class="container"> <div class="content"> <div class="page-header"> <h1><?php echo $page->title; ?><small> effettua l'accesso</small></h1> </div> <div class="row"> <div class="span16"> <fieldset id="formlogin"> <legend>Login</legend> <form action='/login/' method='post' id="loginform"> <div class="clearfix"><label for="login_name">Username</label><div class="input"><input type="text" name="login_name" value="" class="required" /></div></div> <div class="clearfix"><label for="login_pass">Password</label><div class="input"><input type="password" name="login_pass" value="" class="required" /></div></div> <div class="actions"> <input type="submit" value="Accedi" class="btn primary" name="login_submit" id="login_submit" /> </div> </form> </fieldset> </div> </div> </div> <? include('./foot.inc'); ?> </div> <!-- /container --> </body> </html> JS $(document).ready(function(){ $("#loginform").validate({ debug: false, rules: { login_name: { required: true }, login_pass: { required: true } }, messages: { login_name: "Inserisci il tuo username", login_pass: "Inserisci la password", }, submitHandler: function(form) { $("#login_submit").attr('value','Sto accedendo...'); $("#login_submit").attr('disabled', 'disabled'); $.post('/process/login.php', $("#loginform").serialize(), function(data) { if (data=='success'){ var url = "/"; $(location).attr('href',url); }else{ $(".span16").prepend( $(data).hide().fadeIn('slow') ); $(".error").fadeOut(5000); $("#login_submit").attr('value','Accedi'); $("#login_submit").removeAttr('disabled'); } }); } }); }); PHP <?php require_once('../index.php'); $input = wire('input'); if($input->post->login_submit) { $name = wire('sanitizer')->username($input->post->login_name); $pass = $input->post->login_pass; if(wire('session')->login($name, $pass)){ print 'success'; }else{ print '<div class="alert-message error"> <p>Dati non validi. Riprova</p> </div>'; } } ?> After registration i send a welcome email. That's the tempmail php that use the well known phpmailer class for sending emails adding templating functionality. You need to download the class.phpmailer.php from the web. <? function sendingemail_phpmailer ($var_array,$template,$phpmailer,$FromName,$From,$to,$Subject,$videolist){ if (!is_array($var_array)){ echo "first variable should be an array. ITS NOT !"; exit; } require_once($phpmailer); $mail = new PHPMailer(); $mail->IsSendmail(); // telling the class to use SMTP $mail->Host = ""; // SMTP server $mail->FromName = $FromName; $mail->Sender = $FromName; $mail->From = $From; $mail->AddAddress($to); $mail->Subject = $Subject; $mail->IsHTML(true); $filename = $template; $fd = fopen ($filename, "r"); $mailcontent = fread ($fd, filesize ($filename)); foreach ($var_array as $key=>$value){ $mailcontent = str_replace("%%$value[0]%%", $value[1],$mailcontent ); } $mailcontent = stripslashes($mailcontent); fclose ($fd); $mail->Body=$mailcontent; if(!$mail->Send()){ echo "Errore durante l'invio del messaggio"; exit; } } ?>1 point
-
Absolutely! Here is a simple, but functional example for both login and logout templates. You would want to replace the markup with your own markup or includes. Likewise you'd want to change the redirects to redirect to whatever page you want them to go to after completing a login. /site/templates/login.php: <?php if($user->isLoggedin()) { // user is already logged in, so they don't need to be here $session->redirect("/somewhere/"); } // check for login before outputting markup if($input->post->user && $input->post->pass) { $user = $sanitizer->username($input->post->user); $pass = $input->post->pass; if($session->login($user, $pass)) { // login successful $session->redirect("/somewhere/"); } } ?> <html> <head> <title>Login</title> </head> <body> <form action='./' method='post'> <?php if($input->post->user) echo "<h2 class='error'>Login failed</h2>"; ?> <p><label>User <input type='text' name='user' /></label></p> <p><label>Password <input type='password' name='pass' /></label></p> <p><input type='submit' name='submit' value='Login' /></p> </form> </body> </html> /site/templates/logout.php: <?php $session->logout(); ?> <html> <head> <title>Logout</title> </head> <body> <h1>You have logged out</h1> </body> </html>1 point