Forums / Developer / How to make "empty" view in module?

How to make "empty" view in module?

Author Message

Jerry Jalava

Tuesday 22 July 2003 10:16:17 am

HI,

I'm building a new personal adds module and I would like to know is it possible to make an "empty" view to viewlist...

I tried to search it from other modules, but no module has it...

Explanation: If I have module named "adds", and I have assigned views "view" and "edit" to it.
When I surf to /adds/view I get the "view" view and
when I surf to /adds/edit I get the "edit" view, but if I surf to /adds I get "view '' not found in module adds".

It would be nice if I could redirect /adds/ to ie. /adds/view automagiccally :)

Regards,
Jerry

Selmah Maxim

Wednesday 23 July 2003 12:32:44 am

try this, not sure will work !

$ViewMode = $Params['ViewMode'];
if (!$ViewMode)
$ViewMode="view";

Jan Borsodi

Wednesday 23 July 2003 1:01:53 am

To this you must turn of views for your module by editing module.php and setting

$Module = array( "name" => "Adds",
"variable_params" => true,
"function" => array(
"script" => "adds.php",
"params" => array( "ViewMode" ) ) );

You must then do a check in adds.php for ViewMode and open up the correct script accordingly. Something like.

$viewMode = $Params['ViewMode'];
if ( $viewMode == 'view' )
include( 'path/to/script/view.php' );
else if ( $viewMode == 'edit' )
include( 'path/to/script/edit.php' );
else
include( 'path/to/script/view.php' );

--
Amos

Documentation: http://ez.no/ez_publish/documentation
FAQ: http://ez.no/ez_publish/documentation/faq

Jerry Jalava

Wednesday 23 July 2003 9:33:06 am

Thanks, I'll give it a try...

I encountered to other problem...
When I fetch something from template with fetch function, what kind of data my addsfunctioncollection.php should return? (That is the file that returns the data to template after fetch, right?)

It should return somekind of array right? I tracked the module ezurl's functions and founded it too complex for this... ;)

After fetch has been made in template I'm connecting to function_definition.php and through that to addsfunctioncollection.php's function fetchList()... fetchList function gets variables from function fetchListFromDB(). FetchListFromDB returns back to fetchList an arrayquery in a variable and then fetchList returns this to template with [code] return array( 'result' => &$list ); [/code]...
- Should I parse it somewhere before I send it to template?
- How can I get that data in template? ($List:item.?)
- Is there a way to just check everything that comes to template?

OK, I thinks that was already too much to ask, but I hope someone could lighten me up even a bit... I'm soooo close to finnishing this ez portal project. I only need few modules witch I have to make...

Thanks a lot, :D
Jerry