Couple customization questions

Pinacle

New member
How would i get my search page to display a link to the details page..

i.e.

http://www.truuk.nl/form.php?function=search&where_clause=&page=0&table_name=truuk

under ->truuknaam<- hes got the text linked to the 'details' page I essentially want that type of layout as what im doing requires quite a bit of 'extra' detail
the basic search will be showing
id/rep/banid/guid/name/ip/description

the Details would show the above plus
" Alises / Associated IP Addresses / Other Violations "


Also i somehow need to incorporate into one of my fields a way of converting certain 'codes' into colours , an example php script (though im not quite sure how to implement it)

function parse_gamecolors($string)
{
$string = ereg_replace("(\^)?$", "^", $string);
$string = ereg_replace("\^\^", "&#94^", $string);
$string = ereg_replace("(\^)?$", "", $string);
$string = ereg_replace("\^<", "^|", $string);
$string = ereg_replace("\<", "<", $string);
$string = ereg_replace("\^>", "^^", $string);
$string = ereg_replace("\>", ">", $string);
$string = ereg_replace("\^\^", "^>", $string);
$string = "<font color=\"#FFFFFF\">".$string."</font>";

$color_def = array
(
0 => "#000000", 1 => "#FF0000", 2 => "#00FF00", 3 => "#FFFF00",
4 => "#0000FF", 5 => "#00FFFF", 6 => "#FF00FF", 7 => "#FFFFFF",
8 => "#FF7F00", 9 => "#7F7F7F", 10 => "#BFBFBF", 11 => "#007F00",
12 => "#7FFF00", 13 => "#00007F", 14 => "#7F0000", 15 => "#7F4000",
16 => "#FF9933", 17 => "#007F7F", 18 => "#7F007F", 19 => "#007F7F",
20 => "#7F00FF", 21 => "#3399CC", 22 => "#CCFFCC", 23 => "#006633",
24 => "#FF0033", 25 => "#B21919", 26 => "#993300", 27 => "#CC9933",
28 => "#999933", 29 => "#FFFFBF", 30 => "#FFFF7F"
);

$color_chardef = array
(
"#000000" => array ( 0 => "0", 1 => "P", 2 => "p" ),
"#FF0000" => array ( 0 => "1", 1 => "Q", 2 => "q" ),
"#00FF00" => array ( 0 => "2", 1 => "R", 2 => "r" ),
"#FFFF00" => array ( 0 => "3", 1 => "S", 2 => "s" ),
"#0000FF" => array ( 0 => "4", 1 => "T", 2 => "t" ),
"#00FFFF" => array ( 0 => "5", 1 => "U", 2 => "u" ),
"#FF00FF" => array ( 0 => "6", 1 => "V", 2 => "v" ),
"#FFFFFF" => array ( 0 => "7", 1 => "W", 2 => "w" ),
"#FF7F00" => array ( 0 => "8", 1 => "X", 2 => "x" ),
"#7F7F7F" => array ( 0 => "9", 1 => "Y", 2 => "y" ),
"#BFBFBF" => array ( 0 => ":", 1 => "Z", 2 => "z",
3 => ";", 4 => "[", 5 => "{" ),
"#007F00" => array ( 0 => "<", 1 => "\\", 2 => "|" ),
"#7FFF00" => array ( 0 => "=", 1 => "]", 2 => "}" ),
"#00007F" => array ( 0 => ">" ),
"#7F0000" => array ( 0 => "?" ),
"#7F4000" => array ( 0 => "@", 1 => "`" ),
"#FF9933" => array ( 0 => "A", 1 => "a", 2 => "!" ),
"#007F7F" => array ( 0 => "B", 1 => "b" ),
"#7F007F" => array ( 0 => "C", 1 => "c", 2 => "#" ),
"#007F7F" => array ( 0 => "D", 1 => "d", 2 => "$" ),
"#7F00FF" => array ( 0 => "E", 1 => "e", 2 => "%" ),
"#3399CC" => array ( 0 => "F", 1 => "f", 2 => "&" ),
"#CCFFCC" => array ( 0 => "G", 1 => "g", 2 => "'" ),
"#006633" => array ( 0 => "H", 1 => "h", 2 => "(" ),
"#FF0033" => array ( 0 => "I", 1 => "i", 2 => ")" ),
"#B21919" => array ( 0 => "J", 1 => "j" ),
"#993300" => array ( 0 => "K", 1 => "k", 2 => "+" ),
"#CC9933" => array ( 0 => "L", 1 => "l", 2 => "," ),
"#999933" => array ( 0 => "M", 1 => "m", 2 => "-" ),
"#FFFFBF" => array ( 0 => "N", 1 => "n", 2 => "." ),
"#FFFF7F" => array ( 0 => "O", 1 => "o", 2 => "/" )
);

for ($cd1 = 0; $cd1 < 31; $cd1++)
{
for ($cd2 = 0; $cd2 < count($color_chardef[$color_def[$cd1]]); $cd2++)
{
$string = str_replace("^". $color_chardef[$color_def[$cd1]][$cd2], "</FONT><FONT COLOR=\"" . $color_def[$cd1] . "\">", $string);
}
}
return $string;


here is a link to an example its sorta what i need :p

http://enemy-territory.4players.de:1041/modules.php?name=Nick_Colors

though i need the output to be in the Coloured Text in that example
^1Wolf^3Player = (red)Wolf(yellow)Player
 

alpha2zee

Well-known member
For first point

Something like this...

Edit build_results_table in include/business_logic.php; specifically, in the 'for' block beginnjing around lines going
[pre]
$results_table .= "</td>";
for ($i=0; $i<$count_temp; $i++){
[/pre]
The cide generates the HTML table cells, filling them with the data from MySQL tables. Somewhat below is this line
[pre]
$results_table .= $field_to_display." "; // at the field value to the table
[/pre]
$field_to_display is the field value. You can modify this logic to have a link that will show the details page.
[pre]
$results_table .= "<a class=\"onlyscreen\" target=\"_".$edit_target_window."\" href=\"".$dadabik_main_file."?table_name=".urlencode($table_name)."&function=details&where_field=".urlencode($where_field)."&where_value=".urlencode($where_value)."\">".$field_to_display."</a></a>"; // add the field value to the table
[/pre]
With just that, all the table cells will appear as links to the 'details' page, which you probably do not want. So,
[pre]
if ($table_name == 'xxx' and $field_name_temp == 'yyy') // xxx is the table's name and yyy is the field name, only for which the link should be shown
{
$results_table .= "<a class=\"onlyscreen\" target=\"_".$edit_target_window."\" href=\"".$dadabik_main_file."?table_name=".urlencode($table_name)."&function=details&where_field=".urlencode($where_field)."&where_value=".urlencode($where_value)."\">".$field_to_display."</a></a>"; // add the field value to the table
}
else
{
$results_table .= $field_to_display." ";
}
[/pre]

For the second

Can you clarify a bit more? Is it that the $string comes from a MySQL table field and that the field holds values like
[pre]
^1Wolf^3Player
[/pre]
And you want the ^1, ^3, etc., to dictate the color of the adjacent text?



Post Edited (12-10-05 23:31)
 

Pinacle

New member
Essentially what i want todo is during the Insert Process if i enter in

^1Wolf^3Player and 'insert' that entry , when i goto details or search results or what not the output instead of being ^1Wolf^3Player it would be Wolf in red and Player in what ever colour 3 is :p
so kind of a colour parser it takes the colour codes from the basic sql entry converts the ^colour codes into a corresponding colour for the text..


also im using dadabik 3.2
and the first solution u had mentioned made lil to no sense to me (sorry i dont know php what so ever)


Thanks for the help mate :)
 

alpha2zee

Well-known member
The first - solution - is simple to put in. Just edit that business_logic.php file in a code or simple text editor (not MS Word). It's a long file, so you will have to scroll down to look for those lines of code.

I'd suggest putting in the last block of code I have in my first post; instead of xxx, put in the table's name (the MYSQL one) and instead of yyy, the table's field name.

--

For the second, so what I was surmising is correct.

To accomplish this, one again has to edit the same business_logic.php file, editing the code for function get_field_correctly_displaying. I will try posting something on that.
 

Pinacle

New member
#1 for xxx/yyy that only represents one table & one field within that table..

i've got around 10+ tables so wouldnt the above example make it so it would only show the one table you set in the business_logic.php ?
 

alpha2zee

Well-known member
If you want that feature to apply for all tables and if all of them have the same field name, you can just use

if ($field_name_temp == 'yyy')

instead of

if ($table_name == 'xxx' and $field_name_temp == 'yyy')

If the field names are different in the different tables and/or if you want this feature for only some of the tables,
use

if (
($table_name == 'xxx' and $field_name_temp == 'yyy')
or
($table_name == 'aaa' and $field_name_temp == 'bbb')
or
($table_name == 'ccc' and $field_name_temp == 'ddd')
)

Repeat the 'or (clause)' part as per your setup.

For your 2nd point

Edit function get_field_correctly_displaying in business_logic.php file. Look for this line towards the end of the function (line number 2278 in my DaDaBik 3.2's file).
[pre]
$field_to_display = nl2br($displayed_part);
[/pre]
Think of $field_to_display as the $string in your code in the first post. You can then add extra lines of code so that $field_to_display is processed. Depending on which tables and what field names, you do it conditionally, as for the first point. So after the code line (above), add
[pre]
if (
($table_name == 'xxx' and $field_name_temp == 'yyy')
or
($table_name == 'aaa' and $field_name_temp == 'bbb')
or
($table_name == 'ccc' and $field_name_temp == 'ddd')
)
[/pre]
Repeat the 'or (clause)' part as per your setup. Then add these lines
[pre]
{
parse_gamecolors($field_to_display);
}
[/pre]
The parse_gamecolors function can be added at the very top of the business_logic.php file. Remember to have closing curly brackets to end the function (I don't see them in your posting).



Post Edited (12-11-05 08:29)
 
Top