lyceum-users AT lists.ibiblio.org
Subject: Lyceum-users mailing list
List archive
Re: [Lyceum-users] A simple yet important modification to portal.php
- From: Katz <singkit AT gmail.com>
- To: "Adam Geller" <ageller AT gmail.com>, lyceum-users AT lists.ibiblio.org
- Subject: Re: [Lyceum-users] A simple yet important modification to portal.php
- Date: Mon, 29 Oct 2007 20:38:36 +0800
Thanks. I changed the affected files. It worked... I think it's best that jjb would add that up with the next release.
What I was thinking of was a bit complicated. Excluding certain posts with titles like "hello world!" and posts from certain categories and blogs...
For example, you are the administrator of teachfor.us, you can make a blog for announcements and general updates. You want to display posts from that blog on the sidebar. You wouldn't want to see the same posts with "recent posts."
What I'm trying to avoid is repetition. "Do no repeat yourself." I always read that from pragmatic programmers...
I was able to do it before with wordpress. The code, of course, wouldn't work in portal.php.
Thanks for the help...
On 10/29/07, Adam Geller <ageller AT gmail.com> wrote:
Hi Katz,
John will likely reply to you, too, but I figured I could help since I have knowledge on this one.
The recent posts area on portal should exclude "Hello World" posts. At least, it is on teachfor.us, which is where the lyceum portal code was pulled from.
Also, in the current code fixes, there is now a feature to turn off Hello World posts. I would recommend this. They are definitely a pain in the multi-blog setting. See http://source.ibiblio.org/trac/lyceum/ticket/859 for more info on that. Doing so will also keep Hello World posts from coming up in the site-wide atom feed.
Best,
adam
http://TeachFor.UsOn 10/28/07, Katz <singkit AT gmail.com > wrote:Hi. I am Katherine/Katz/sikatzonline/chillmoz and planetjazz.org developer._______________________________________________
I made this simple hack to portal.php
If you have lyceum 1.0
You should see this:
<?php
define('WP_USE_THEMES', true);
$blog='NULL';
$blogdata='NULL';
$optiondomain = 'system';
$_REQUEST['b']='system';
require('private.php');
require(CONFIGPATH . 'wp-config.php');
get_currentuserinfo();
$site_title = get_settings('site_title');
$wpdb->query("
CREATE TEMPORARY TABLE bloginfo
SELECT $wpdb-> blogs.id, $wpdb->blogs.slug, option_value as blogname, status
FROM $wpdb->blogs
INNER JOIN $wpdb->options ON ($wpdb-> blogs.id = $wpdb-> options.blog)
INNER JOIN $wpdb->posts
INNER JOIN $wpdb->post2cat ON (post_id = $wpdb->posts.ID)
INNER JOIN $wpdb->categories ON (category_id = cat_ID AND $wpdb->categories.blog = $wpdb->options.blog)
WHERE
status = 'active' AND
option_name = 'blogname' AND
post_title != 'Hello world!' AND
post_title != 'About'
ORDER BY post_date_gmt DESC
");
$blogs = $wpdb->get_results("SELECT DISTINCT(id), slug, blogname, status FROM bloginfo ORDER BY blogname ASC");
$posts = get_recent_posts(8);
if ( isset($_SESSION['slug_error']) ) {
$slug_error = $_SESSION['slug_error'];
unset($_SESSION['slug_error']);
Before ?>
Insert:
// TRUNCATE POSTS AND STRIP TAGS FUNCTION
function postsTruncate($string, $limit, $break=".", $pad="...") {
if(strlen($string) <= $limit) return $string;
if(false !== ($breakpoint = strpos($string, $break, $limit))) { if($breakpoint < strlen($string) - 1) { $string = substr($string, 0, $breakpoint) . $pad; } }
return strip_tags($string); }
// ===========================================================================
And change:
<blockquote>
<?php
echo strip_tags($p->post_content) . '...'." <a href="\"$p->guid\">read" more</a>";
?>
</blockquote>
to:
<?php
echo postsTruncate($p->post_content,200) . '...'." <a href="\"$p->guid\">read" more</a>";
?>
Not a very clean code but anyone can feel free to use it.
Just one big question:
How do I exclude "Hello World" posts from being displayed for the recent posts?
--
CHILLMOZ
http://www.chillmoz.com
Lyceum-users mailing list
Lyceum-users AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/lyceum-users
--
CHILLMOZ
http://www.chillmoz.com
-
[Lyceum-users] A simple yet important modification to portal.php,
Katz, 10/28/2007
-
Message not available
-
Re: [Lyceum-users] A simple yet important modification to portal.php,
Katz, 10/29/2007
-
Message not available
- Re: [Lyceum-users] A simple yet important modification to portal.php, Katz, 10/31/2007
-
Message not available
-
Re: [Lyceum-users] A simple yet important modification to portal.php,
Katz, 10/29/2007
-
Message not available
Archive powered by MHonArc 2.6.24.