News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Table around the posts themselves, where is it?

Started by Kasperl, July 03, 2005, 12:08:21 PM

Previous topic - Next topic

Kasperl

Ok, I'm an SMF newbie, and not all that good with CSS or PHP, but I manage. I'm trying to get a look for my SMF forum to work right, and I've almost succeeded, except for the following:

- I can't change the table border around the posts themselves, I can't find where I'm supposed to change it. In what file of the default theme is it? (A line number would be greatly appreciated, but just a filename will help me)
- I'm still looking for an easy way to make all the blue in all the buttons red. Is there a PHP option for this?
- If there isn't such a thing, is it possible to remove most of the buttons and turn them into text links instead?
- Is there any mod, or way to code one, to make it possible for the users to select colours within a theme? (Think winamp3 skinning system.)

I do have one not so style related question:
- Is it possible to throw 1100 rows into the member table, and make SMF treat them as registered members? (Assuming that all colums are correctly filled, off course.)


Thanks in advance for any help. I couldn't find the forum rules, but I hope this is in the right forum.

[Unknown]

Quote from: Kasperl on July 03, 2005, 12:08:21 PM
- I can't change the table border around the posts themselves, I can't find where I'm supposed to change it. In what file of the default theme is it? (A line number would be greatly appreciated, but just a filename will help me)

It's all in the Display template.  Unforunately, nested tables are used there - but that's how it works, currently.

Quote- I'm still looking for an easy way to make all the blue in all the buttons red. Is there a PHP option for this?

I'm not sure I understand.  If you mean recoloring the buttons, I'm afraid not.

Quote- If there isn't such a thing, is it possible to remove most of the buttons and turn them into text links instead?

There's an option in your theme settings for just that.

Quote- Is there any mod, or way to code one, to make it possible for the users to select colours within a theme? (Think winamp3 skinning system.)

Many of Bloc's and Mystica's themes do indeed support just this.

Quote- Is it possible to throw 1100 rows into the member table, and make SMF treat them as registered members? (Assuming that all colums are correctly filled, off course.)

Yes.  You just need memberName, emailAddress, realName, passwd, and dateRegistered.

-[Unknown]

Kasperl

Thanks for the help, should I just take a theme with the multi colour support, and see how they did it, or is there documentation?

As for recouloring the buttons, that's already done, but thanks.

One more question: Is it possible to add columns to the members table without breaking anything?

[Unknown]

Quote from: Kasperl on July 04, 2005, 07:30:46 AM
Thanks for the help, should I just take a theme with the multi colour support, and see how they did it, or is there documentation?

I'd suggest that, yes.... I'm not sure that anything was posted specifically about it, but I may have something laying around...

Quote from: [Unknown] on January 17, 2005, 04:28:37 AM
Quote from: Mystica
i'd like to put a dropdown menu on the index page of a theme where users and guests can select the color of the theme (means the css file, or even the images directory if that's possible).

CSS file is completely possible.  Not as sure about the images one... I think so.  I had actually been meaning to mention this to you ;).

Quotenow i'm not too good with coding, i already asked bloc, he tried something, but it didn't work. he said he could maybe get something like this done when the selector would be in the admin section or the user profile, but i'd love to have the dropdown menu on the index page.
i remember that you said you could help with something like this when the theme contest was running, so i thought i'd just ask you. any chance you could help with this?

Of course I can help, theme contest or not ;).  There are a few ways to do this, but let's start with the basics (which you probably already have somewhat, but I'm just clarifying because you said you weren't good with code.)

First, in the "init" sub template, we'd want to set the images URL.  I'm actually not sure if setting it there will work, but if it's going to work anywhere that would be the place.  Anyway, inside that function, you'd do something like:

if (isset($options['theme_color']) && file_exists($settings['theme_dir'] . '/' . $options['theme_color'] . '_images'))
   $settings['images_url'] = $settings['theme_url'] . '/' . $options['theme_color'] . '_images';
else
{
   // Defaults.
   $options['theme_color'] = isset($settings['default_theme_color']) ? $settings['default_theme_color'] : 'blue';
   $settings['images_url'] = $settings['theme_url'] . '/' . $options['theme_color'] . '_images';
}


So, this does a few important things.  First, it checks to see if they've even picked a color.  Then it makes sure the color is valid (security.)  If either of these fails, it falls back on the default - named default_theme_color in the theme's admin settings.  Failing that, it uses blue (I like blue ;).)

Then, in the above template, you'd replace:
<link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/style.css" />

With:
<link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/', $options['theme_color'], '.css" />

So far so good.  Now, at least, if there was an option in the profile it should work and do its job.  There are even administrative defaults.  But, this still doesn't show it on every page, does it?

To do that, we need to set the theme options in that init template, in certain cases.  Really, I need to make an easy to use function to do this, but for simplicity's sake we'll cheat.  Put this above the other part in the init sub template:

if (!$context['user']['is_guest'] && isset($_POST['options']['theme_color']) && file_exists($settings['theme_dir'] . '/' . $_POST['options']['theme_color'] . '_images'))
{
   include_once($GLOBALS['sourcedir'] . '/Profile.php');
   makeThemeChanges($context['user']['id'], $settings['theme_id']);
   $options['theme_color'] = $_POST['options']['theme_color'];
}
elseif ($context['user']['is_guest'])
{
   if (isset($_POST['options']['theme_color']) && file_exists($settings['theme_dir'] . '/' . $_POST['options']['theme_color'] . '_images'))
   {
      $_SESSION['theme_color'] = $_POST['options']['theme_color'];
      $options['theme_color'] = $_SESSION['theme_color'];
   }
   elseif (isset($_SESSION['theme_color']))
      $options['theme_color'] = $_SESSION['theme_color'];
}


Not terribly shabby, huh?  The first part can only be for guests, and checks if the option is sent and is valid.  Then it uses the profile to save the change!  Lovely how simple some things can be.  The next part is a little more tricky if you don't know PHP: it uses the session (which keeps going every page view) to remember what the guest selected, since theme options can't.  And, it also checks to see if the session is already remembering, and uses it if so.

Now, all that we need is the actual dropdown, yes?  Simple as this:

<form action="', $scripturl, '" method="post"><select name="options[theme_color]" onchange="this.form.submit();">
   <option selected="selected" value="', $options['theme_color'], '">Current</option>
   <option value="red">Red</option>
   <option value="blue">Blue</option>
</select><noscript><input type="submit" value="Go!" /></noscript></form>


Okay.  Stick that where ever you please in the above or below templates.  You'll probably want to modify the Settings template to add the options in there for the administrator... it's probably relatively easier, but if you need help with that too, send me another pm.

Does this work?  If so, I might post it on the Tips and Tricks board as well to get people thinking... assuming this is okay with you?

-[Unknown]

QuoteOne more question: Is it possible to add columns to the members table without breaking anything?

Yes, but it means extra coding work of course.

-[Unknown]

Advertisement: