Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Data Model Questions /

[Solved] conditional handling/displaying of information


Reply


940 Views

Avatar
Hankster

Community Member, 14 Posts

16 May 2009 at 8:51am

Edited: 20/05/2009 3:10am

I have been working to on a segment of a site to allow people to contribute toward one of several projects under different categories. Right now, I have a page that displays a list of projects under, let's say, the category of "Internal Projects." Each item in the list has a "Donate" link. So here is where my knowledge breaks down: What I would like is:

- For this link to go a non-data related page that contains some boilerplate text dependent on the project category (not really wanting to do conditional processing the template) i.e. "Thank you for deciding to contribute to this *Internal Project*. Please select ..."

- Carry with it/pass on some additional information, such as the project name and a code (that's not stored as part of a project, but is category related and necessary for prefilling/completing the online donation form.)

- On the page displayed, I need to provide choices for the person from which to select (click on a link) that will take them to the appropriate page from which they can make their donation.

I have scoured the forums and have found bits and pieces, but I can't seem to get it all put together.
Can anyone help me out?

TIA,
Henry

Update: For my "donate" link, I tried formatting a url with parameters as in "choose?t=proj&n=internal", but was unable to pull the values off using $_GET['t'] in either the model or the controller. I was, however, able to use the Director in the model if I formatted the url in my donate link like "choose/a/proj/internal". This allowed me to pull the donation type (proj) using Director::urlParam('ID') and the name using Director::urlParam('OtherID') from within the model. The 'a' in the url is used as a placeholder just so I could get at the ID and OtherID values (couldn't read the 'Action' value through the Director).

I put this in a simple function in the model such as:

function SupportingProject() {
$result = (Director::urlParam('ID')=='proj')?True:False;
return $result;
}

Which allowed me to do simple 'If..else..end if' processing in the template:

<% if SupportingProject %>
Thank you for choosing to support this project....
<% else %>
Thank you for choosing ....
<% end_if %>

Not the cleanest implementation, I know. I'm still willing to hear better suggestions for accomplishing this.
- Henry