Jump to:

23481 Posts in 18951 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » text only version ?

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 1239 Views
  • Loic
    Avatar
    Community Member
    4 Posts

    text only version ? Link to this post

    Hi there

    I need to build a site that can offer a text-only / low-bandwidth version... can it be done with SilverStripe ?

    Cheers

    Loic
    Web designer Hobart
    www.ultimedia.com.au

  • dalesaurus
    Avatar
    Community Member
    283 Posts

    Re: text only version ? Link to this post

    If you design it that way, you sure can! If you need it to be able to switch on the fly you can try the detection that has been done with Mobile: http://www.ssbits.com/detecting-mobile-browsers-to-re-theme-your-site/

  • Loic
    Avatar
    Community Member
    4 Posts

    Re: text only version ? Link to this post

    I don't need the automatic detection, just the option to view the site without images, etc.

    So would it be just a matter of changing templates... sorry I've never used SilverStripe

  • dalesaurus
    Avatar
    Community Member
    283 Posts

    Re: text only version ? Link to this post

    Yep, that would do it. You could also just use some apache .htacces kung-fu to not serve images if you wanted to take a brass tacks approach.

  • banal
    Avatar
    Community Member
    901 Posts

    Re: text only version ? Link to this post

    As previous posters said: It can easily be done with custom templates.
    The SilverStripe WYSIWYG Editor allows insertion of images too, so you might want to replace the Editor with a TextAreaField, or just disable the Image Button using HtmlEditorConfig: http://doc.silverstripe.org/doku.php?id=htmleditorconfig

    You could also output raw text in the template by using $Content.RAW (http://doc.silverstripe.org/doku.php?id=text).

  • patjnr
    Avatar
    Community Member
    101 Posts

    Re: text only version ? Link to this post

    Hi

    Here is the code that pulls content only from the live published pages. We use it for generating printable pages. Modify it to suit your situation.

    Create a new page type (maybe contentPage.php)

    paste this function in the controller

    PHP

    public function PrintContent() {
          $content = Versioned::get_one_by_stage('SiteTree', 'Live', "SiteTree_Live.URLSegment = '".$_GET['urlSegment']."'");
          return $content->Content;
       }

    Template

    <script language="javascript">
    function printContent() {
       window.open("/contentprint?urlSegment=$URLSegment","mywindow","menubar=1,resizable=1,width=700,height=700,scrollbars=1");
    }
    </script>

    in all templates create an href

    <a href="javascript:printContent();">text version</a>

    in you ContentPage.ss use

    $Content
    $PrintContent

    and this template can have its own CSS

    hope this will help you

    1239 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.