LeiHa Posted April 25, 2013 Share Posted April 25, 2013 I've been building message and error system. And I've noticed that PW uses Jquery highlight message system, which is very easy to use. Some of PW module do this like, $this->message('message here'); $this->error('error message here'); And it seems like automatically generate markup for the Jquery to handle.(If I understand correctly) So, are message and error methods only for use inside of class? If I'm not getting it, please let me know. Thank you. Link to comment Share on other sites More sharing options...
WillyC Posted April 25, 2013 Share Posted April 25, 2013 massage and error for admin no ? use them like this u can two $pages->error('bad man'); $session->message('hi'); wire('pages')->error('bad bad.man'); wire('session')->message('hiho'); work.for any api vrable it does 4 Link to comment Share on other sites More sharing options...
LeiHa Posted April 26, 2013 Author Share Posted April 26, 2013 I've found out that I actually have to put this code below. <?php if(count($notices)) include($config->paths->adminTemplates . "notices.inc"); ?> This code is from default.php from admin files. Link to comment Share on other sites More sharing options...
Wanze Posted April 26, 2013 Share Posted April 26, 2013 LeiHa, You need to tell us more what you want to achieve. In your modules, you can generate messages / error-messages like WillyC mentioned. Pw will output them automatically in the admin. However, if you speak from your own templates aka frontend, I'm not sure what you want to do Link to comment Share on other sites More sharing options...
diogo Posted April 26, 2013 Share Posted April 26, 2013 I don' think it's a good idea to make your site depend of something like this. If something changes with an upgraade, it will break everything. 1 Link to comment Share on other sites More sharing options...
LeiHa Posted April 26, 2013 Author Share Posted April 26, 2013 Sorry about the confusion. I'm still trying to understand how to implement this in the frontend site. The message system in admin backend site seems wonderful and I'd like to use it in the frontend. At first, I thought that I could just use $this->error('some text'); or $this->message('some text'); in the frontend. Eventually those didn't work of course. And tried to find out how to use this system(I assume Ryan made this. So impressive!!!) Link to comment Share on other sites More sharing options...
diogo Posted April 26, 2013 Share Posted April 26, 2013 The system is using jquery ui. You can use the theme roller to create your own theme, and then apply it to the messages on your site, just like Ryan did with the admin. Link to comment Share on other sites More sharing options...
LeiHa Posted April 26, 2013 Author Share Posted April 26, 2013 Thanks all of you. I'm starting to understand a bit. I'll look up Jquery UI roller site and see how things work. Thank you. Link to comment Share on other sites More sharing options...
ryan Posted April 29, 2013 Share Posted April 29, 2013 The notices system actually doesn't have anything to do with jQuery UI other than that the default admin theme makes use of jQuery UI class names when generating the markup for notices. But for your own front-end, you can make use of the $notices API variable to output them however you want. It can be as simple as this: echo "<ul>"; foreach($notices as $notice) { $class = $notice->className(); $text = $sanitizer->entities($notice->text); echo "<li class='$class'>$text</li>"; } echo "</ul>"; Then you would want to style the two type of notices in your CSS: .NoticeMessage { color: green; } .NoticeError { color: red; } 9 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now