Jump to:

3460 Posts in 1064 Topics by 739 members

Data Model Questions

SilverStripe Forums » Data Model Questions » DataObject from another Page

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 414 Views
  • feitanx
    Avatar
    Community Member
    11 Posts

    DataObject from another Page Link to this post

    Hi,

    Can I get the data from the data object of the other page?

  • Pigeon
    Avatar
    Community Member
    243 Posts

    Re: DataObject from another Page Link to this post

    You'll need to provide much more info than that for us to be able to help.

    What is the current architecture and what are you trying to achieve?

  • feitanx
    Avatar
    Community Member
    11 Posts

    Re: DataObject from another Page Link to this post

    I have page where there is a form, when it is submitted all the data is save into the database. And So I want to preview it(those data) on another page.

  • feitanx
    Avatar
    Community Member
    11 Posts

    Re: DataObject from another Page Link to this post

    <?php
    class PreviewEmail extends Page {
    private static $has_one = array(
    'AgentsInfo' => 'SaveEmail'
    );
    }
    class PreviewEmail_Controller extends Page_Controller {

    }

    <?php

    class SaveEmail extends DataObject {
    private static $db = array(
       'AgentName' => 'Varchar',
       'Address' => 'Varchar',
       'Email' => 'Varchar',
       'Company' => 'Varchar',
       'Phone' => 'Int',
       'Dropdown' => 'Varchar',
       'Dropdown2' => 'Varchar');
    }
    <% include SideBar %>
    <div class="row" style="padding-left:40px">
       <article>
          <div class="row" id="AEH" ><h2 style="color:#fe7700">$Title</h2></div>
           <% if $AgentsInfo %>
          <% loop $AgentsInfo %>
    <p>Agent Name:$AgentName</p>
    <% end_loop %>
                <% end_if %>
       
       
       </article>
    </div>

    414 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.