Ulysses
General => Off-Topic => Topic started by: TwinbladeTM on October 03, 2009, 06:45:59 PM
-
I would like to know whether it is possible for the MOTD to be set up using CSS. It's my understanding that GMod doesn't like .htm files, and I have a limited understanding of CSS...What I'm ultimately looking for is a Web template that I can use in the MOTD, to give it a nicer look than the stock MOTD. Any Suggestions?
-
CSS is just a list that defines params for styles and classes. For the most part the html interpreter used by the motd function will understand html, some dhtml, css, and a very little bit of java. If you would like me to build you an motd I certainly will, just shoot me off a pm and we'll get things set up.
Anyways, back to your original query. Yes, it is possible for the motd to use styles defined in css.
motd.txt
<html>
<head>
<script type="text/css">
#body {
background: #FFFFFF;
}
#topbar { width: 80%; height: 50px; background: #009900; margin-left: auto; margin-right: auto; }
</script>
</head>
<body>
<div style="topbar"> Lolsup </div>
I liek tuwtals
</body>
</html>
-
The text inside of ulx_motd.txt is actually HTML.
As for CSS, or any HTML, it all depends on what the actual Source html interpreter allows, not Gmod itself.
Unless it's been improved in the past 2 years, Source html interpreter is very limited as to what it allows.
I've used CSS within the motd html before, but I put it inline using the style tag, not a separate file.
You may use a separate CSS file, but only if you host it on a publicly accessable web server and use the <link> tag to link to it.
Attempting to use locally stored images/files within the Source html won't work.
-
OK, so I would like to have the CSS code embedded in the .txt, how would go about doing that?
This is what the beginning of my code looks like...it's pretty much greek to me. :/ And do I need the metatags? It was originally part of a template I have.
html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>MOTD</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
-
This topic is really going past what this forum area was meant to be...support of ULX, ULib (and occasionally, other Ulysses releases) - Hence why I moved it.
The link tag, which includes the href=<local file.css> won't work in Source html interpreter UNLESS you're hosting that file on a web server. You can't (easily) link to a local css file, which I just said in previous post.
You would need to open the css file you have, and teach yourself how to include it INSIDE the original html file using the <style> tag.
-
Sorry about dragging it off topic...but continuing with my query, I got most of the CSS to work internally with the <style> tags. Now my question is can you get it to bring up images? For instance, most of the layout of the template I'm using is images, can I get it to bring those up, or do they absolutely have to be hosted elsewhere?
-
They have to be hosted elsewhere. Might I suggest you read this: http://forums.ulyssesmod.net/index.php/topic,4183.0.html
-
or do they absolutely have to be hosted elsewhere?
Yes.
Attempting to use locally stored images/files within the Source html won't work.
In THEORY, one could write a script so that it would send a few images, store it in the same folder as where the motd.txt gets saved on the client, then point to the same images location within the motd.txt
But you might as well have a fast sv_downloadurl and web host location to host them in that case, as the time involved sending images from the local pc isn't worth the time most players like to wait.
-
OK, I hosted the images elsewhere and managed to get it to work. Thaks for all your help, guys! :)
-
If you're using SVN you can now use a url to the motd instead of using the text file. :)
-
If you're using SVN you can now use a url to the motd instead of using the text file. :)
I knew if I ignored Umotd long enough features from it would start being incorporated into ULX.
:P
-
Now the question is, are there directions on how to do so? (I haven't updated my SVN in a while...) I'll have to update soon. linking it would be far more convenient than hosting just the images and throwing enough of the CSS into a .txt file to show up correctly :)
-
Just set ulx showMotd to a url. :)