1
BobbyC
Help with a default theme hack
  • 2004/1/8 15:31

  • BobbyC

  • Just popping in

  • Posts: 29

  • Since: 2003/11/16


I'm hoping some generous soul will take pity on a designer who's motivated to learn how to program.

What I want to do is move the login and search to a table between the header and the main theme table in theme.html.

I can move the actual login code to theme.html and get it to display and function. BUT I don't know how to make its display conditional.

E.g.,

If not logged in,
1 Display a table between the header and
main tables containing
a Login fields
b Lost Password link
c Register Now link
d Search field
e Advanced Search link

If logged in,
1 Switch from anonymous to registered
user group
2 Remove Login table display
3 Display table containing:
a Log out link
b Current day and time
c Search fields
d Advanced Search link

Thanks in advance.

Bob

2
CBlue
Re: Help with a default theme hack

Here is some code you can use (you will have to edit it to fit your style.css and layout but this will put the info horizontally across your page before the left/center/right blocks begin.

<div id="nav">
<div class="spacer"></div>
<div class="yourclassname">
<span class="left" align="middle"><img src="<{$xoops_imageurl}>bullet.gif" alt="" />
<{if $xoops_isuser}>
Welcome <a href="<{$xoops_url}>/user.php"><{$xoops_uname}></a>
<{else}>
<a href="<{$xoops_url}>/register.php">Register</a>!
<{/if}></span>
<span class="yourclassname">
<{if $xoops_isuser}>
<a href="<{$xoops_url}>/user.php?op=logout">Logout</a>
<{else}>
<a href="<{$xoops_url}>/user.php">Login</a>
<{/if}>
</span>
</div>
<div class="spacer"></div>
</div>

You could add a more detailed welcome to the username if you put this in the place of the plain Register above:

<{else}>
<a href="<{$xoops_url}>/register.php">Register</a> for Your site name here

For your search put:

<form action="<{$xoops_url}>/search.php" method="post">
<input type='text' name='query' value='Search Our Site' size=15 onMouseOver="this.focus();" onFocus="if(this.value == 'Search') this.value = '';" class='yourclassname'>
<input type="hidden" name="action" value="results" />
<input type="submit" class="yourclassname" value="Go!" name="searchSubmit" /><br />
<a href="<{$xoops_url}>/search.php">Advanced search</a>
</form>

3
CBlue
Re: Help with a default theme hack

For current date and time, I would just use a javascript for that, but you can use whatever you find that will do that.

4
BobbyC
Re: Help with a default theme hack
  • 2004/1/9 14:35

  • BobbyC

  • Just popping in

  • Posts: 29

  • Since: 2003/11/16


Thank you for taking pity on a poor ignorant designer . The If/else construction is what makes the various possibilities conditional, right. So what you're saying is if x is true do one thing and if x is false do something else?

I recognize some of the variables from poking around in the various template and theme files. But not, for example, $xoops_isuser. Did you make it up for the code snippet or is that one of many XOOPS variables available for such times?

Well thanks again.

Bob

5
kahumbu
Re: Help with a default theme hack
  • 2004/1/9 16:39

  • kahumbu

  • Documentation Writer

  • Posts: 277

  • Since: 2003/8/23


That's a global Smarty variable in XOOPS. If you're still experimenting with XOOPS, i.e. it is not yet a public site, you can turn on Smarty Debugging to check out the Smarty variables available per page. Go to System Admin -> Preferences -> General Settings to change debug settings.

6
BradM
Re: Help with a default theme hack
  • 2004/1/10 2:11

  • BradM

  • Just popping in

  • Posts: 78

  • Since: 2003/8/14


Quote:
The If/else construction is what makes the various possibilities conditional, right. So what you're saying is if x is true do one thing and if x is false do something else?


Yes, that's it exactly. I don't think you need to have an else statement unless you really need it (ie. you don't have to include an empty else condition). In the case of a registration link vs. a login window, then you would want the if/else structure. However if you just want to display "Hello <username>!" to all registered users, then you'd just use an if statement to display the message if a member is viewing the site.

You might want to take a look at the Xoops Wiki. This link takes you to the section covering global variables. It relates more to modules, however it should help you to better understand how the XOOPS system works.

Good luck!

Brad
(also new to php)

7
CBlue
Re: Help with a default theme hack

You need the else because it's an option for if the person is a registered user or someone who needs to register.

8
BobbyC
Re: Help with a default theme hack
  • 2004/1/10 21:31

  • BobbyC

  • Just popping in

  • Posts: 29

  • Since: 2003/11/16


Thank you CBlue, kahumbu, and Brad for being so generous with your time and knowledge. I made the changes to theme.html and they actually worked.

Over the years I've opted for Adobe GoLive to create and manage websites and have assiduously avoided editing in "source" mode and programming.

Thanks to your contributions I'm neck-deep in the source code and loving it. Who says you can't teach an old dog new tricks

Well I'm not SO old.

For my next trick, I want to move the menu above the content as well. Is that something best handled by creating a new block?

Bob

9
CBlue
Re: Help with a default theme hack

You can't move the menu above the columns with a block. You can put any type of menu you want above the blocks code in theme.html though. I have added javascript script menus, html menus and graphic type menus above, beside and below my logo.

10
Dave_L
Re: Help with a default theme hack
  • 2004/1/11 4:48

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Quote:
you can turn on Smarty Debugging to check out the Smarty variables available per page


What does that do exactly? I turned it on, but don't see any extra information displayed.

Login

Who's Online

221 user(s) are online (147 user(s) are browsing Support Forums)


Members: 0


Guests: 221


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits