bwakad Posted March 31, 2014 Share Posted March 31, 2014 So today I learned about render, retrieving fields / pages and selectors in general. I have to admit, many times I do not know, often I look at Skyscrapers to see some interesting stuff, read the API and see the the forum where many guru's are active. As such I learned some and added my own lines in the render function. // get field province, from current page, store in location $location = $page->get('province'); // use markup, get url and title of location, store in where $where.= "\n\t<li><a href='{$location->url}'>{$location->title}</a></li>"; // and then finally output 'where' plus it's markup, inside table $out = "\n<table class='blahblah'>" . "\n\t<tbody>" . "\n\t<tr><th>Province</th><td>" . ($where ? "\n<ul>$where</ul>" : $na) . "</td></tr>" . "\n\t</tbody>" . "\n</table>"; return $out; Link to comment Share on other sites More sharing options...
diogo Posted March 31, 2014 Share Posted March 31, 2014 Your head must be a puzzle right now. I have the feeling that you just skipped the basics, and are looking at random things, some even too complicated for starting. I don't want to tell you how you should learn, everyone has it's own way, but I feel that you're taking the longer and less exciting path. Just sayin' 2 Link to comment Share on other sites More sharing options...
Pete Posted March 31, 2014 Share Posted March 31, 2014 Are you adding markup inside the render function in the class directly? That's how I'm reading it from your post above. All of that should be done in the /site/templates/ file for the relevant page template. This tutorial will help you understand rather than picking apart something more complex: https://processwire.com/talk/topic/693-small-project-walkthrough-planets/ 1 Link to comment Share on other sites More sharing options...
bwakad Posted March 31, 2014 Author Share Posted March 31, 2014 I know I know... I just wanted to see how it works. But you are right. I think markup should be in the template file rather then through render. So it's easier to read. So I just deleted all files, emptied DB, and started on a fresh dev install (no site profile other then basic one). Made some pages and some loops to get a list in my template file. And since this list becomes veryyyyyy long I really need a css to attach, like bootstrap (easy) or foundation (litle hard). I just don't want all the files like site-profile from http://processwire/modules gives because you all will tell me to start with a fresh install again. lol 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