Midnight Modding Posted March 8, 2018 Posted March 8, 2018 I've always hated anything to do with design, but am trying my best. I have been looking through suite html files and also had read through help guides several times. For me it's a victory that I got a simple sidebar and grid on the page and the page title and a button. lol. Luckily I have barely any pages to do a complicated view on. Mostly grids and tables. 1. there are a lol of "data-" in them. Such as links with data-parent-id and data-node-id. Is there anything like that I need to be using when working with nodes and content items? Are those examples I just gave basically shortcuts to forming the url and data- is used where it recognizes what it's for? (edit: after looking more, I guess data- is when some IPS js fucntionality is needed?) 2. documentation says responsiveness is usually automatic and I was under the impression that we could get by without doing anything related to it, but I see a ton of hideDesktop and hidePhone in the templates. I am only trying to add quite simple html. I was hoping I wouldn't need to do anything with responsiveness when I hate hate hate design. 3. 4.x seems to have a lot more checks and php in the templates than past versions. I am usually a lot more comfortable doing that in the controllers. I guess I should try to do most checks related to whether something shows on the screen in the templates, but hopefully it's still considered acceptable personal preference on how far to go with code being in the template vs. the controller.
bfarber Posted March 8, 2018 Posted March 8, 2018 1) data-X attributes are typically to give javascript the data it needs to perform actions (this is better practice than setting javascript variables in <script> tags). If you aren't doing much with javascript you won't need to use these attributes most likely. 2) Most responsiveness is automatic (especially if you are using stuff like 'grids'), but often times you want to hide something on desktop or phone, which is what those classes are for. Making everything show a little nicer on phones is one thing, and tailoring a view so it is as good as it can be on phone or desktop is another. How far you go with tailoring views to each viewport is up to you. 3) You shouldn't show things to users who can't use them/see them in templates, but you always always need to check on the backend regardless. Hiding a link from a user who can't delete isn't good enough because they can always visit the URL directly, so you need to check on the backend too. That said...you don't want to show the link to the users who can't use it.
Midnight Modding Posted March 8, 2018 Author Posted March 8, 2018 On #3, yes I know. I've always gone out of my way to check for those situations from when I first started making apps. I just mean for any given page's html, you can obviously do checks in the php file instead and pass a variable to the template. Plus it just seems like more is being done in the html files than usual. Defining/setting variables, for instance, which I normally would do in the php file and pass to the template. So, in other words, when I talked about php file checks, I wasn't talking about the backend checks, I was talking about checks to affect the html templates. For instance you could do a check for which image to show, in the html file, or you could do it in the php file and pass $image to the template. I've typically done the latter in past versions. Most of the checks in the php file and pass the data those checks create. But I am debating doing more of it in the templates.
bfarber Posted March 9, 2018 Posted March 9, 2018 It's up to you ultimately. Another route, which we take in many areas, is to create a "canDoSomething" method in the model and call that from the template.
Midnight Modding Posted March 9, 2018 Author Posted March 9, 2018 9 minutes ago, bfarber said: It's up to you ultimately. Another route, which we take in many areas, is to create a "canDoSomething" method in the model and call that from the template. yeah that is something I was actually about to do also. In general, I am trying to do more in the templates. For my link bar, in 3.x I set up all the links in the php file, but this time I did it in a template. And now trying to choose between many ways of doing a global button... I need to just start making decisions quickly and finishing this. :)
Recommended Posts
Archived
This topic is now archived and is closed to further replies.