21287 Posts in 5733 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1036 Views |
-
text only version ?

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 -
Re: text only version ?

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/
-
Re: text only version ?

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
-
Re: text only version ?

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.
-
Re: text only version ?

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=htmleditorconfigYou could also output raw text in the template by using $Content.RAW (http://doc.silverstripe.org/doku.php?id=text).
-
Re: text only version ?

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
$PrintContentand this template can have its own CSS
hope this will help you
| 1036 Views | ||
|
Page:
1
|
Go to Top |




