View Full Version : Coding Question
meells
12-06-2006, 03:01 AM
Hi all,
I am wondering if it is possible to have OCD not display the text for the label of a custom field. Example, if I enter "hi" into custom field 4 box, what will return is "custom field 4:hi" (
or whatever i may rename that label.) can it just say "hi"? It would also work if the label could adjust itself based upon what I enter into the box, but that seems even more problematic. Such as, if I enter "a", it simply says "hello", and if I enter "b", it would then say "howdy", or what-have-you.
Maybe one of you helpful coders out there have an idea? Thanks much.
meells
12-06-2006, 03:26 AM
OK, I took care of that one. Thanks anyway folks if you were thinking on it.
meells
12-06-2006, 03:30 AM
So now what I am wondering is this: can I have the text I enter appear in different colors depending upon what I have entered? i.e., "hello" appears in yellow, "howdy" appears in red? Something along those lines. Thanks.
pheisholt
12-06-2006, 03:32 PM
Yes, you can. If you pass the value of the custom field to a javascript, you can format it exactly the way you want.
The javascript function could be something like this:
[color=green]function colorMyText(val)
{
meells
12-07-2006, 04:46 AM
Great, Paul, you are the man! Unfortunately, I am not :(. I am running into an issue- I already have a js function in the album page header that creates icons based on trackauthor value, when I enter this new function after it in the header, it disables them both. I am no whiz, i just cut and paste :(. What am I missing with the placement of the function? Also, I inserted the call in the area that says:
<!---->
<!---->
</b>
<script language="javascript">
<!--
colorMyText("dax:custom4/");
//-->
</script>
</b><!--[custom4/]--><br>
<!---->
<!---->
I tried a few different placements, so I have no idea if I inserting this after the correct line or anything. I may be placing them both incorrectly. Sorry I am so lame. I prostrate myself before your wisdom and lead where you follow me. (Now thats a vote of confidence!)
meells
12-07-2006, 05:17 AM
Sorry, I realize part of the problem was that I forgot to mention I am in the old version of OCD, and the new uses different tags. I hadn't gotten into the editor to know they had changed. I have made so many little changes to the daxedit in the old version I fear I could never get it back quite the same if I went to 6.x. But I am happy with it. Ok thanks.
pheisholt
12-08-2006, 08:35 PM
Hi meells
You can have as many javascript functions you like in the header section or anywhere else for that matter. But the code has to be correct.
Since you're using OCD 5.x, you can't use the new DAX-tags. The only difference in the script I posted is in the last part, which should look like this:
<script language="javascript">
<!--
colorMyText("<!--[Custom1/]-->");
//-->
</script>
-paul-
pheisholt
12-08-2006, 09:27 PM
Hi meells
Moving from OCD 5.x to OCD 6.x is really not that difficult. I would strongly recommend that you switch to the latest version, and use the new DAX-fomat.
This is what you need to do to your template:
1. Make a backup copy of the template you are using (and have modified). If the original is called Crisp.dax, you could name the copy Crisp6.dax, for instance. (Actually it might be a good idea to also do a complete backup of your Template folder)
2. Make a copy of your OCD database folder (that's the folder where your *.dab-files are located). Backup the entire folder.
3. Download the latest OCD 6.x version, and install it. But first make sure you've got a copy of the OCD 5.2.x installation file, in case you decide you want to go back to the old version.
4. Open your template copy (Crisp6.dax) in the new version 6.x Dax-editor (C:\Program Files\OrangeCD\daxedit.exe)
5. Select the Declarations tab, and add the following line to the top of the Declarations page:
DAX_VERSION = 2;
6. Select one tab at a time (Start, Album etc...) and perform the following search and replace operations (CTRL+H) on each page:
i)
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.