View Full Version : Posting announcements on website.
I need to have a fool/idiot proof way of posting announcements to a website.
Its for a local school, and they basically have zero technical knowledge, so editing pages and uploading are out of the question - believe me, I've tried! :lol: :lol:
So, the way I would imagine it working would be something like:
They would go to a password protected page, something like: http://schoolname.county.sch.uk/announce
And they would be presented with a basic textbox with a few very basic editing options. Like font colour, size and bold. Thats all.
Then they could type the announcement and it would update an area on the main frontpage at:
http://schoolname.county.sch.uk/home.htm
anyone want to give it a go?! :lol:
anyone want to give it a go?! :lol:
Not really :P. Hopefully someone with more free time can help.
But I can tell you that normally it'd be done with a database. Basically have a 'news' table, an admin page which lets you insert some content chunk into that news table (with a WYSIWYG editor if you want to be fancy and allow them to format the announcement) and then some simple code in the front page to check for current announcements and display them if there are any.
The details of how exactly to do that are really rather tied up in the nature of the website; i.e. what database (if any) it uses at present, what server-side scripting languages (if any) are in use, etc, etc.
If you don't have a database, you will have to make do by substituting some code for reading/writing to a text file for the database insert/select code.
Even better, rewrite the site such that it uses a CMS like Drupal or whatever from the ground up, thereby giving them the ability to manage their own content.
See, thats the thing. Looking at it, it looks like the server is running a very basic set of software, and I'm not sure that running a database is even possible.
One way that I know would work would be to just put an invisible flash element on the page, and have that read the text from a file.
I'm not really that up for rewriting the whole site just for the sake of a couple of announcements for when it gets a bit cold and icy! :lol:
check this out for the server side bit
http://www.intranetjournal.com/php-cms/
Actually, thinking about it, I may just do it like that with the flash thing.. Anyone want to give writing the text box bit a go, to allow them to write to a file without having to upload anything!? :D
I had this problem too. Andy's way sounds good, but I went even simpler and have a forum, which parses messages in an "announcement" forum to the front page. It's currently broken as I was a plonker and didn't update phpBB for ages (read: I didn't bother looking at it until someone went to make an announcement), and it got hacked so had to disable said announcement forum. However, if you want a lol, check it out - http://saggyork.org.uk/
I can give you the code I used if you want.
Actually, thinking about it, I may just do it like that with the flash thing.. Anyone want to give writing the text box bit a go, to allow them to write to a file without having to upload anything!? :D
Hmm, problem is, if you have a client-side technology able to write to the server, it's a bit of a security hole :P. Generally that's not something you can do with javascript or swf if everything's been set up properly.
Ah - I was hoping you could do it with some sort of java thing as you said....
Well - they might just have to learn how to upload things then! :lol: Unless anyone else can think of anything?
Nick - if you've got something pre written, then that might be good. The only reason I don't want people spending lots of time on this is because I am unsure what software they have installed on the server, and so it could be a lot of work that runs well on a decent server, but not on this one. But if you've got something that I can have a play with and adapt and test to see if it actually works, then it might be worth it! :)
why not have it as a photobucket image, and just update the image then overwrite in photobucket = updated site.
Haha, I like it :). And upload a 1 x 1 pixel transparent gif when there is no news? :)
I accept paypal and visa.
thanks :)
So this is the PHP that I'm using (credit to Peter (http://forums.aria.co.uk/member.php?u=2088) for writing this)
<?php
/*
* At the end of the script, if $newsItem['success'] is true then we succeeded in grabbing
* a topic from the database. If it's false, it failed.
* The actual post is contained within $newsItem['msg'], this contains an error message
* if it failed.
*/
// Full path to your phpBB installation including trailing slash
$phpbb_root_path = '/home/xxxx/public_html/forums/';
// News forum ID
$fid = "2";
// URL to your forum WITH the trailing slash
$forum_url = "http://www.someexample.co.uk/forums/";
define('IN_PHPBB', true);
define('PHPBB_ROOT_PATH', $phpbb_root_path);
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
// Pretend we're using prosilver
$user->theme['template_path'] = 'prosilver';
$sql = "SELECT * FROM phpbb_topics, phpbb_posts, phpbb_users WHERE phpbb_topics.forum_id = ".intval($fid)." AND phpbb_topics.topic_first_post_id = phpbb_posts.post_id AND phpbb_topics.topic_poster = phpbb_users.user_id ORDER BY topic_time DESC";
$result = $db->sql_query_limit($sql, 1, 0);
if (!$result || mysqli_num_rows($result) == 0) {
$newsItem['success'] = false;
$newsItem['msg'] = "There was an error grabbing the latest news item.";
}
else {
$news = mysqli_fetch_array($result);
$newsItem['success'] = true;
$newsItem['topic_id'] = $news['topic_id'];
$newsItem['topic_url'] = $forum_url."viewtopic.php?f=$fid&t=".$news['topic_id'];
$newsItem['topic_title'] = $news['topic_title'];
$newsItem['poster_id'] = $news['topic_poster'];
$newsItem['poster_profile_url'] = $forum_url."memberlist.php?mode=viewprofile&u=".$news['topic_poster'];
$newsItem['poster_username'] = $news['username'];
$newsItem['topic_time'] = $news['topic_time'];
$newsItem['msg'] = generate_text_for_display($news['post_text'], $news['bbcode_uid'], $news['bbcode_bitfield'], 7, true, true, true);
}
print_r($newsItem);
?>
Hope that's of some use.
Ha... Thats a bodge idea if ever there was one!
I'm not sure they'd cope with image editing too!
EDIT: Not the code, I meant the picture solution! :lol:
Well, works well for my society :lol: WYSIWYG editing and instant posts make it super simple and until the forums were hacked, "it was super effective" :P
Well, works well for my society :lol: WYSIWYG editing and instant posts make it super simple and until the forums were hacked, "it was super effective" :P
:lol: I think we might've got our posts crossed :lol:
Haha, it would appear so, my bad :lol:
Nick, i might actually put that to some use... *starts day dreaming*
Is the school webserver hosted by them? It's just a simple matter of installing mySQL and PHP to the webserver if so, a single php file should be more than enough for something like this.
Nope.. I know exactly how to install the relevant things to the server, and I would do so if I could.. Unfortunately its hosted by the county, and I can only get ftp access to it and nothing more. It wont allow me to install software to it..
Hmm, in which case, try testing for php, i seem to remember my old school having a county website and that has php on a windows server, so aspx aswell.
<?php
phpinfo();
?>
but i'm sure you already know this part
Yeah, I already did... Its a no go... I know a couple of the guys at the place where its hosted so I could try and speak to them and get it enabled, but i'm not sure they will!
So this is the PHP that I'm using (credit to Peter (http://forums.aria.co.uk/member.php?u=2088) for writing this)
<?php
/*
* At the end of the script, if $newsItem['success'] is true then we succeeded in grabbing
* a topic from the database. If it's false, it failed.
* The actual post is contained within $newsItem['msg'], this contains an error message
* if it failed.
*/
// Full path to your phpBB installation including trailing slash
$phpbb_root_path = '/home/xxxx/public_html/forums/';
// News forum ID
$fid = "2";
// URL to your forum WITH the trailing slash
$forum_url = "http://www.someexample.co.uk/forums/";
define('IN_PHPBB', true);
define('PHPBB_ROOT_PATH', $phpbb_root_path);
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
// Pretend we're using prosilver
$user->theme['template_path'] = 'prosilver';
$sql = "SELECT * FROM phpbb_topics, phpbb_posts, phpbb_users WHERE phpbb_topics.forum_id = ".intval($fid)." AND phpbb_topics.topic_first_post_id = phpbb_posts.post_id AND phpbb_topics.topic_poster = phpbb_users.user_id ORDER BY topic_time DESC";
$result = $db->sql_query_limit($sql, 1, 0);
if (!$result || mysqli_num_rows($result) == 0) {
$newsItem['success'] = false;
$newsItem['msg'] = "There was an error grabbing the latest news item.";
}
else {
$news = mysqli_fetch_array($result);
$newsItem['success'] = true;
$newsItem['topic_id'] = $news['topic_id'];
$newsItem['topic_url'] = $forum_url."viewtopic.php?f=$fid&t=".$news['topic_id'];
$newsItem['topic_title'] = $news['topic_title'];
$newsItem['poster_id'] = $news['topic_poster'];
$newsItem['poster_profile_url'] = $forum_url."memberlist.php?mode=viewprofile&u=".$news['topic_poster'];
$newsItem['poster_username'] = $news['username'];
$newsItem['topic_time'] = $news['topic_time'];
$newsItem['msg'] = generate_text_for_display($news['post_text'], $news['bbcode_uid'], $news['bbcode_bitfield'], 7, true, true, true);
}
print_r($newsItem);
?>
Hope that's of some use.
I cant get any of this to work D:
D:
The actual code I have in use (got rid of references to my site, replaced with xxxx just to try and stop spam bots lol) is this;
<?php
define('IN_PHPBB', true);
define('PHPBB_ROOT_PATH', '/home/xxxx/public_html/forums/');
$phpbb_root_path = '/home/xxxx/public_html/forums/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
// Pretend we're using prosilver
$user->theme['template_path'] = 'prosilver';
$sql = "SELECT * FROM phpbb_topics, phpbb_posts, phpbb_users WHERE phpbb_topics.forum_id = '2' AND phpbb_topics.topic_first_post_id = phpbb_posts.post_id AND phpbb_topics.topic_poster = phpbb_users.user_id ORDER BY topic_time DESC";
$result = $db->sql_query_limit($sql, 1, 0);
if (!$result || mysqli_num_rows($result) == 0) {
$newsItem = 'There was an error displaying the news! Go complain at Nick who will then in turn complain at me.';
}
else {
$news = mysqli_fetch_array($result);
$newsItem = '<div class="bl"><div class="br"><div class="tl"><div class="tr">
';
$newsItem .= '<a href="'.htmlspecialchars('http://www.xxxx.org.uk/forums/viewtopic.php?f=2&t='.$news['topic_id']).'" style="color: #105289; font-weight: bold;">'.$news['topic_title'].'</a>';
$newsItem .= ' <span style="font-weight: normal;">posted by</span> <a href="'.htmlspecialchars('http://www.xxxx.org.uk/forums/memberlist.php?mode=viewprofile&u='.$news['topic_poster']).'" style="color: #AA0000; font-weight: bold;">'.$news['username'].'</a> » '.date('D M d, Y g:i a', $news['topic_time']);
$newsItem .= '
<hr />
';
$newsItem .= generate_text_for_display($news['post_text'], $news['bbcode_uid'], $news['bbcode_bitfield'], 7, true, true, true);
$newsItem .= '
</div></div></div></div>
<div class="clear"> </div><br /><br />';
}
echo $newsItem;
?>
By Pete's own admission, it's a bit old (18 months) and he's become tidier and more efficient at coding since that. If it's still not working I'll get him to check out this thread as he knows a zillion times more about coding than me.
Just to check, you are using phpBB when trying this Smifis?
Yeah, phpbb3, lastest version 1.0.8 i think, will have to check,
I'll bodge it together :D
Thanks Nick,
Added after 4 minutes:
Got it,
Havn't got mysqli, only mysql functions. always something simple eh,
Thanks again
This is like banging my head against a brick wall....
So I've found that the server supports NOTHING - apart from ASP. So I've created a script that writes text to a text file and then a flash movie picks it up from there. However, in running the script, I've now found that every single directory is read only, other than through the FTP client.... i've tried setting permissions on the folder I created (I thought it was just the root folder that it was complaining about), but no joy :(
Yeah, phpbb3, lastest version 1.0.8 i think, will have to check,
I'll bodge it together :D
Thanks Nick,
Added after 4 minutes:
Got it,
Havn't got mysqli, only mysql functions. always something simple eh,
Thanks again
Yeah I think there's a function in the phpBB DB API to collect results but I don't think I could be bothered to learn it in order to just collect some results when a stock PHP function would do. :p
This is like banging my head against a brick wall....
So I've found that the server supports NOTHING - apart from ASP. So I've created a script that writes text to a text file and then a flash movie picks it up from there. However, in running the script, I've now found that every single directory is read only, other than through the FTP client.... i've tried setting permissions on the folder I created (I thought it was just the root folder that it was complaining about), but no joy :(
Two options then really:
1) Teachers learn to FTP. There are decent clients out there, this may well be the sensible option, and you can explain that it's not really avoidable because the website has no database and the permissions make it impossible for the website to write data to the filesystem.
2) A bit dodgy and more complex; set up a reciever application on ANOTHER webserver which you do control, and get your ASP script to post and retrieve to/from that external site.
I'd go with option 1, personally.
I'd go with option2, a little bit of javascript on the front page that pulls the message from another system hosted elsewhere, one of the many free blogs.
How about Twitter, why not set up a twitter account @schoolnameSnow or something?
A quick google, there are many jscript things that read twitter 'feeds', http://tweet.seaofclouds.com/
DT.
Yeah good point, javascript might be a decent option becuase that means you don't have to dirty your hands with classic ASP.
Only problem with the twitter option is the character restriction of course. But on the other hand they might like it because tweeting is 'trendy' :P.
I'd go with option2, a little bit of javascript on the front page that pulls the message from another system hosted elsewhere, one of the many free blogs.
How about Twitter, why not set up a twitter account @schoolnameSnow or something?
A quick google, there are many jscript things that read twitter 'feeds', http://tweet.seaofclouds.com/
DT.
Twitter provides feeds in JSON if you want it so they're very easy to read with JavaScript or most server side languages. I imagine it wouldn't be difficult to learn the ASP to do it, however JavaScript seems to be the easiest way forward here.
I'm quite liking the Twitter idea - hadnt thought of that... Would be fairly easy to implement actually.
I'll look into that! :)
two files?
one php acess file with a set password (enrcypted with md5/sha1) and then a txt doc or html doc?
WYSIWYG editor on the php access file which then writes via fwrite to the html file???
could try write up a quick code for you.
no need for a database or anything, just two files.
:D??
He doesn't have access to PHP, only old school ASP.
Powered by vBulletin® Version 4.1.12 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.