Decide on the approach..
Drupal is very powerful, it's so flexible that you have many ways to do things. That's why a 5 minutes of thinking is very recommended before we get our hands dirty.The solution I thought of will work like this:
- We will write a separate function, will call it garland_user_bar(). It decide, and return HTML for the login form, or the welcome message. It will contain the necessary code to check which one it should return.
- In page.tpl.php, we will place a call to this function somewhere where it gets displayed in the top.
- Back to the function, If it should show a login form, then it will just borrow the default login form, we will not try to create our own. Why? Because likely, the default form, while it looks rectangular in shape and fits in many lines, by checking view-source I could tell that we can style it using CSS just like in the screenshots without changing anything in the form itself.
- If the user is already logged in, the function will instead return a nice welcome message, and some helpful links.
- Now we have the logic, after that we will write some CSS to style it, to change how it looks.
没有评论:
发表评论