Several questions: Linking valuelists, fueleconomydb looks..

A place for users and developers of the Xataface to discuss and receive support.

Several questions: Linking valuelists, fueleconomydb looks..

Postby Sly » Wed Aug 27, 2008 9:09 am

Hi there,

I'm starting with Xataface, it's a great tool.

1st question:
I have a feature database, with different sub-levels.
I'd like to use several linked valuelists to narrow down the possibilities.
I have around 700 different features to choose from, but each feature has 4 levels

So for example, when I select something in the first value list, I would like to dynamically update the second value list to narrow down possibilities, and so on until the fourth value list.

Can this be done easily using *.ini files, or do I have to use PHP/SQL code for this?

2nd question:

I very much like the looks of the fueldatabase. Can I get the sourcecode somewhere? I'd like to get the same looks and feel as this page for example, with possibility to choose the car class on the left, etc...:
http://fueleconomydb.com/index.php?-action=list&class=COMPACT+CARS&-sort=combined_mpg+desc

3rd question:
If I have to customize the PHP code, this has to be done in the index.php file at the root of each application? or separate file?
For example, based on value list selection I will do, I'd like to fill an HTML table corresponding to the selection I have done.

4th question:
Is it possible to embed different widgets? For example, I'd like to have a table of selects or checkboxes.
Sly
 
Posts: 7
Joined: Wed Aug 27, 2008 2:27 am
Location: Toulouse, France

Postby Jean » Wed Aug 27, 2008 11:58 pm

Hi,
For the first question, your answer is here (http://xataface.com/forum/viewtopic.php?t=4150#20865)
Jean
Jean
 
Posts: 259
Joined: Wed Nov 07, 2007 1:30 am
Location: Pau, France

Postby shannah » Thu Aug 28, 2008 1:58 pm

I'd like to get the same looks and feel as this page for example, with possibility to choose the car class on the left, etc...:


The code for this section is as follows (as a method in the application delegate class):
Code: Select all
function block__after_left_column(){
      $out = array();
      $res = mysql_query("select distinct `class` from vehicles_summary", df_db());
      if ( !$res ) trigger_error(mysql_error(df_db()), E_USER_ERROR);
      while ($row = mysql_fetch_assoc($res) ){
         if ( preg_match('/^\d+$/',$row['class']) ) continue;
         if ( strlen($row['class']) < 5) continue;
         $out[] = "<a href=\"".DATAFACE_SITE_HREF."?-action=list&class=".urlencode($row['class'])."&-sort=combined_mpg+desc\" title=\"".ucfirst(strtolower($row['class']))." with the best gas mileage.\">".ucwords(strtolower($row['class']))."</a>";
      }
      @mysql_free_result($res);
      echo implode('<br />', $out);
   
   }


Notables here:
1. The method name block__after_left_column() means that the output of this method will be displayed in place of the after_left_column block (add debug=1 to the beginning of your conf.ini file to see the names of the available blocks).

2. We are basically building a menu of links which take advantage of the Xataface url conventions to specify particular found sets in particular orders.

If I have to customize the PHP code, this has to be done in the index.php file at the root of each application? or separate file?
For example, based on value list selection I will do, I'd like to fill an HTML table corresponding to the selection I have done.


There are many ways to customize the application.. You can accomplish most things in delegate classes, by overriding slots and blocks.

Is it possible to embed different widgets? For example, I'd like to have a table of selects or checkboxes.

Yes.. but documentation on this is a little scarce right now. The simple answer is that you can override the %field_name%_widget block for the field that you want to customize and then do your thing.

-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 13 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved