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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

text only version ?


Go to End


6 Posts   1824 Views

Avatar
Loic

Community Member, 4 Posts

19 November 2009 at 12:19pm

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

Avatar
dalesaurus

Community Member, 283 Posts

19 November 2009 at 3:28pm

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/

Avatar
Loic

Community Member, 4 Posts

19 November 2009 at 5:03pm

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

Avatar
dalesaurus

Community Member, 283 Posts

19 November 2009 at 5:05pm

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.

Avatar
bummzack

Community Member, 904 Posts

19 November 2009 at 8:47pm

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

Avatar
patjnr

Community Member, 102 Posts

19 November 2009 at 10:05pm

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