Linking different components into your own custom page.

Sergiu Tesu Posted in Beginning Developers 6 years ago

I can't find the right way / flow to link different components to my custom pages created in OSSN.
For example I want to use the OssnSitePages to let the administrator create his own content trough the text editor, and display it with my custom style, exactly like it is done for the footer with the about, terms and privacy pages.

Another example, I want to use the Group component and the Event component and display them into a single page with my custom style. Having for example some group members in one side and the events in the other.

I am a new developer and I would really appreciate some help.

Replies
dk Sergiu Tesu Replied 6 years ago

Hi again, I bought the events components and I am wondering how do you get the view responsible for the list of events to display in a custom page created with OssnSitePages? By copy pasting the content from the view won't work, it will give the Events not found error..

The copy pasting way works for add event view for example but won't for the whole event list...

dk Sergiu Tesu Replied 6 years ago

Oh thank you a lot! :) this solved my problem :D

Indonesian Arsalan Shah Replied 6 years ago

If you see ossn_com.php of sites pages a function ossn_site_pages , in function you will see a switch cases , within the case just remove the code and echo your html stuff, when you call that page you will see your own html code rather OSSN page layout.

dk Sergiu Tesu Replied 6 years ago

So basically like a CMS, you have an editor you add some text and you have it displayed with your styles and containers, but for each independent page, not an overall layout like OssnSitePages has right now.

Do you think that is possible ? If yes how to achieve it? Thank you in advance for your answers.

dk Sergiu Tesu Replied 6 years ago

Is it possible to have custom html for a singular page using OssnSitePages? For example if we have a contact page and a terms page, and in the contact page I want a contact form and some images, and in the terms page a complete different layout?

I can use the editor "source code" but that won't allow me to use PHP for echoing out different stuff..
I've tried to register a new textarea <textarea name="pagebodysecond" class="ossn-editor"><?php echo html_entity_decode($OssnSitePages->description2); ?></textarea>, and save it $save->pagebodysecond = input("pagebodysecond"); in the edit form but I have no idea how to register it into the `public function SaveSitePage() {
$this->title = '';
$this->description = trim(htmlspecialchars($this->pagebody));

    $this->owner_guid = 1;
    $this->type = 'site';
    $this->subtype = "sitepage:{$this->pagename}";
    //check if page exists of not
    $this->pageget = $this->getObjectsByTypes();
    if (!is_array($this->pageget)) {
        if ($this->addObject()) {
            return true;
        }
    } else {
        $data = array('description');
        $values = array($this->description);
        if ($this->updateObject($data, $values, $this->pageget[0]->guid)) {
            return true;
        }
    }
    return false;
}`

and further down into <div class="ossn-site-pages-body"> <?php echo $params["contents"]; ?> </div>

Is it possible to do it like that? thank you.

Indonesian Arsalan Shah Replied 6 years ago

You can try to clone the OssnSitePages component and replace terms, about, privacy with your own page name. In clone you have to change everything as ossnsitespages, and edit the ossn_com.php file, you will also require to change files names.

The other approach is to use the blog component and renaming blogs/ to pages/ and add a tinymce editor to the blog adding form , and restrict the blog creating and its menu item , to the administrator only.