21280 Posts in 5729 Topics by 2600 members
| Go to End | Next > | |
| Author | Topic: | 3456 Views |
-
Re: Query Data from a custom Table

13 March 2009 at 1:16am
what is 'LocationSubmission' ? I don't think it is a page? If it's not a page then it can't have a link. Try replacing the <% control ShowLocation %> with the the function I suggested so <% control GetLocations %>. This will return the child pages which are of 'Location' type so if you wanted each location to be listed then you need to make a page for each.
I think you are getting confused with what is and what isn't a page. If you want LocationSubmission to have a link it needs to have it's own LocationSubmission.php with a model and a controller extending Page and Page_Controller respectively. It also needs a template file LocationSubmission.ss.
Have a look through the tutorials to see how all this stuff works. http://doc.silverstripe.org/doku.php
-
Re: Query Data from a custom Table

13 March 2009 at 1:39am
Hello Aram,
i am trying to deal with the Docs the whole time, but now i am stuck.
Let me Explain what i have now.
The LocationSubmission is:
The Page where i submit my Locations on the Frontend, they are saved into the DB.
Files are created: LocationSubmission.php and ...ssThe Page Locations:
This is the Holder Page, where ALL Locations are listed, but only an Overview.
with a Link i want to go deeper to the DetailPage wich is "Location".The Pages "Locations" and "Location eintragen" are created with the CMS.
You can see the Pages here:
"Mehr" is more for the Link to the Details.
Am i better in my Description now?
-
Re: Query Data from a custom Table

13 March 2009 at 6:52am
Tell us, what do you mean by "custom" table?
Is it build without using silverstripe's database builder tool? -
Re: Query Data from a custom Table

13 March 2009 at 7:41am
I Created the Table with PHP File within "mysite/code" to store the Forminserts.
-
Re: Query Data from a custom Table

13 March 2009 at 8:04am
Sorry, I do not understand the meaning of your words.
Please post the content of that file. -
Re: Query Data from a custom Table

13 March 2009 at 8:06am
<?php
class LocationSubmission extends DataObject {
static $db = array(
'Name' => 'Varchar(200)',
'Author' => 'Varchar(100)',
'Email' => 'Varchar (100)',
'Description' => 'Text',
'Adress' => 'Varchar(150)',
'PLZ' => 'Int(5)',
'Location' => 'Varchar(50)',
'Country' => 'Varchar(50)',
'Table' => 'Varchar(150)');
}
?>And the FolderStructure attached as an Image.
Thank you.
-
Re: Query Data from a custom Table

13 March 2009 at 8:31am
What you are doing there is defining an object with the attributes it will have and where to store them.
Now you can get each attribute in your view like you did with:
<% control LocationShow %>
....
$Name
$Description
$Adress
$PLZ<% end_control %>
This calls the method LocationShow of your LocationHolder class.
LocationHolder per Definition is the Holder for the children.
You defined the children using:
static $allowed_children = array(
'Location'
);
in you LocationHolder class.This means objects of type Location will be stored in the Holder class.
Tell me, what does your definition for the Location object look like?
Please post the code. -
Re: Query Data from a custom Table

13 March 2009 at 8:37am
Currently the Location.php ist empty or has just this one:
<?php
class Location extends Page {
}
class Location_Controller extends Page_Controller {
}?>
BUT - the $Link in the LocationHolder.ss is empty.
I dont get it.
| 3456 Views | ||
| Go to Top | Next > |



