Jump to content
Tom

SimpleNews

Recommended Posts

SimpleNews

SimpleNews is a basic module which builds upon the default functionality of the phpVMS News system, allowing you to show a list of links to latest news items, a paginated view of news items and an individual page per item.

No attribution or link back is required (see Licence).

Installation

To install, simply extract the contents of the zip archive and drag the contents into the root public folder of your phpVMS installation.

Usage

To display a list of latest news items anywhere on your site, call the following:

<?php SimpleNews::NewsList(); ?>

By default the list will show the 5 latest items, however you can configure it to show however many you wish, as follows:

<?php SimpleNews::NewsList(10); ?>

You can link to a paginated list of news items at index.php/SimpleNews or a certain page of the list at index.php/SimpleNews/page/2 etc.

(In theory this is compatible with the likes of the jQuery infinite scroll plugin, but I haven't tested it)

You can also link to a single news item like so: index.php/SimpleNews/item/1

Licence

Released under the ☺ Licence

Feel free to edit this code however you want. Please also don't hesitate to fork this repo and raise pull requests in order to extend the module however you feel is appropriate.

View on github: https://github.com/t...ritt/SimpleNews

Download zip: https://github.com/t.../zipball/master

  • Like 1

Share this post


Link to post
Share on other sites

Tom, can you make an update to run in phpvms 5.5 released by simpilot to run in php 5.5 an up?, i have errors when ru in this environment by the problems using the reserved word this--> in the php 5.4 environment.

Regards

  • Like 1

Share this post


Link to post
Share on other sites

Works great but for some reason all my news after i publish have a stupid question marks arround the text ...for example : � RWY�10/28�CLSD�DUE TO�WIP.

Share this post


Link to post
Share on other sites

Works great but for some reason all my news after i publish have a stupid question marks arround the text ...for example : � RWY�10/28�CLSD�DUE TO�WIP.

This plugin doesn't make any changes for input/output encoding. You'll want to check the encoding on the phpVMS news table vs the encoding you've specified in the header. For best support you'll want them to be UTF8.

Share this post


Link to post
Share on other sites

Tom, can you make an update to run in phpvms 5.5 released by simpilot to run in php 5.5 an up?, i have errors when ru in this environment by the problems using the reserved word this--> in the php 5.4 environment.

Regards

What errors?

Share this post


Link to post
Share on other sites

What errors?

I get strict standards errors when i change the .tpl files to .php

Strict Standards: Non-static method NewsData::GetNews() should not be called statically, assuming $this from incompatible context in public_html/core/modules/SimpleNews/SimpleNews.php

Strict Standards: Non-static method NewsData::Truncate() should not be called statically, assuming $this from incompatible context in public_html/core/templates/simplenews_page.php

Strict Standards: Non-static method NewsData::IsNextPage() should not be called statically, assuming $this from incompatible context in public_html/core/templates/simplenews_page.php

Strict Standards: Non-static method NewsData::CountPages() should not be called statically, assuming $this from incompatible context in public_html/core/common/NewsData.class.php

when not changed i get this

Strict Standards: Non-static method NewsData::GetNews() should not be called statically, assuming $this from incompatible context in public_html/core/modules/SimpleNews/SimpleNews.php on line 18

Notice: The template file "public_html/core/templates/simplenews_page.php" doesn't exist in public_html/core/classes/TemplateSet.class.php on line 231

Share this post


Link to post
Share on other sites

This is how I fixed my strict standard errors when converting to 5.5

Open core/common/NewsData.class

Find public function and replace it with public static function. Most cases there are several lines that need to be replaced.

Share this post


Link to post
Share on other sites

This is how I fixed my strict standard errors when converting to 5.5

Open core/common/NewsData.class

Find public function and replace it with public static function. Most cases there are several lines that need to be replaced.

but did you change the .tpl files to .php?

Share this post


Link to post
Share on other sites

Okay so i was able to get it to work with your modification of the NewsData.class

but i also found that in order to use the code

<?php SimpleNews::NewsList(); ?>

you must also change the "public function" to "public static function" in the core/modules/SimpleNews/SimpleNews.php i believe there is 4 lines to edit

but when i click on the news to read it it takes me to the news page and gives me this

Fatal error: Using $this when not in object context in public_html/core/modules/SimpleNews/SimpleNews.php on line 39

Share this post


Link to post
Share on other sites

I dont use that mod, I will install it and see if I can get the errors to go away and than zip it to you.

I'd really appreciate that. What mod do you use for news?

Share this post


Link to post
Share on other sites

Open core/classes/CodonModule.class.php

Right after <?php on a new line add

ini_set('error_reporting', E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);

Share this post


Link to post
Share on other sites

Open core/classes/CodonModule.class.php

Right after <?php on a new line add

ini_set('error_reporting', E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);

that doesnt do anything

i still get this error when accessing /index.php/SimpleNews/item/1

Fatal error: Using $this when not in object context in /home3/vdelta/public_html/beta/core/modules/SimpleNews/SimpleNews.php on line 39

i get this error when accessing /index.php/SimpleNews

Fatal error: Using $this when not in object context in /home3/vdelta/public_html/beta/core/modules/SimpleNews/SimpleNews.php on line 17

Share this post


Link to post
Share on other sites

Looks like my question marks on news are only showing if i use space , when i look for the code source and have -   space on news page after publish instead space i have question marks.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...