Welcome to Geeklog, Anonymous Sunday, December 22 2024 @ 08:24 am EST
Geeklog Forums
Help for a dedicated theme
evol5
Anonymous
Hi all, I just browsed around for a great script to manage news...I found phpnuke...but it was too STATIC to me...so I arrived to geeklog and I saw it was even great than nuke...anyway...
I have a problem...
I am building a noprofit site for animals and I would fit geek with my graphic...
you can take a look at www.zampetta.org/prova.php
As you see if you are visiting it
I would at the top and on the left/right fixed menus that links to a specific category, in the center I would have four boxes, each with last three stories headlines inside...
Is this possible or I have to use static templates (when I write static i mean unchangeable as I would)
Thanks in advance for your support
Evol
10
13
Quote
Anonymous
Anonymous
Hi. I think you can do it by using the Staticpage feature that comes
with geeklog, as well as building a theme to go with it (which could
integrate your stylish menu). For example, you can create a
Staticpage (which accepts html and php) to make it look like how
you want it, like in your example page. When you create it, you can
title it "Frontpage" and it automatically becomes the first thing you
see on top of the front page of your website. You can do the same
thing for other "topic" pages of you website by using this method.
Basically, since Staticpage allows you to design a html page that looks exactly as you want it AND have it become integrated as part of the rest of the site, you have a lot of flexibility in how your site looks.
Another way of making it look EXACTLY like how you have it in your example page would be to create a theme for it. Check here for how to create a theme.
Basically, since Staticpage allows you to design a html page that looks exactly as you want it AND have it become integrated as part of the rest of the site, you have a lot of flexibility in how your site looks.
Another way of making it look EXACTLY like how you have it in your example page would be to create a theme for it. Check here for how to create a theme.
8
9
Quote
Anonymous
Anonymous
Hi, thanks for your reply...
I would create a theme for that graphic...what I would is just some quick hints if you or somebody else can:
1) What is the php code I have to put inside my four boxes to display last three headlines of a specific category?
2) When I click on the headlines...or in whatver else link I would like that my graphic is all the same, changing only in the center where article/story will appear
Thanks again
Evol
6
10
Quote
Anonymous
Anonymous
1) maybe this will help?
2) I think I know what you're trying to say... it seems like you could accomplish this by creating your theme to have all the outlining graphics with the center area empty for the articles to appear. Then, for your first page with all the tables, you can use the Staticpage's "Frontpage" trick I mentioned earlier and include the tables in the staticpage.
2) I think I know what you're trying to say... it seems like you could accomplish this by creating your theme to have all the outlining graphics with the center area empty for the articles to appear. Then, for your first page with all the tables, you can use the Staticpage's "Frontpage" trick I mentioned earlier and include the tables in the staticpage.
8
10
Quote
Anonymous
Anonymous
Yes I think you understood me, but I'm finding difficultous these things cause It would be really better, if there was a way (for a php newbie) to extract PHP code to let me insert everywhere I want "What's new"... "Suerveys" ... I can change their position only from administration panel but I was wondering if someone was successful extracting the code, for example using $print headlines ... (something like this...a variable) I don't know if I am clear cause english isn't my native language, but I hope I am...
I would be useful an exaustive guide to themes... one i found is a little bit skinny...
Thanks again
Evol
11
7
Quote
Status: offline
rawdata
Forum User
Full Member
Registered: 02/17/03
Posts: 236
What is the php code I have to put inside my four boxes to display last three headlines of a specific category?
Step 1: Put the function below in a file and name it headlines.php and place it somewhere on your server. Adjust the configuration variables if desired.
Step 2: Put these two lines at the very top of your file and adjust the paths so they point to where these files are located relative to your other one:
require_once('lib-common.php');
include_once('headlines.php');
Step 3: Call the below function (one or more times) wherever you want the headlines to display for a topic on your page. Like this:
$display = Headlines('Geeklog');
echo($display);
or
echo(Headlines('Geeklog'));
Replace the word Geeklog here with the topic id you want displayed. Be sure each time you call this function that it falls between so the server knows to execute the code.
-------------------------------------------------------------------------------
<?php
function Headlines($topic_id)
{
global $_TABLES, $_GROUPS, $_USER;
/***************************************************************************/
/* Set these configuration variables to meet your website's requirements */
/***************************************************************************/
// maximum number of stories to display under each topic.
$num_stories = 3;
// if you want to display stories only within a certain time interval, then
// uncomment and set this variable to the desired time frame. If set to zero
// or if left commented out, all stories will be displayed up to the max number
// desired ($num_stories) regardless of time period.
// $newstoriesinterval = 86400; // this time is in seconds (86400 = 24 hours)
// maximum number of characters to display in a story's title
$max_title_length = 20;
/****************************************************************************/
/* Please do not modify the code below unless you know what you are doing */
/****************************************************************************/
// initialize variables
$display = '';
$group_list = '';
$perms = '';
// return empty string if variables are not set properly or user has no access
if (!isset($topic_id) OR (sizeof($topic_id) < 1) OR
!isset($num_stories) OR !is_numeric($num_stories) OR
!SEC_hasTopicAccess($topic_id)) {
return $display;
}
// get a listing of all groups to which the visitor belongs
if (!empty($_USER['uid'])) {
foreach ($_GROUPS as $grp) {
$group_list .= $grp . ',';
}
$group_list = substr($group_list, 0, -1);
}
// set up the permission checker
if (!empty( $_USER['uid'])) {
$perms .= "(owner_id = {$_USER['uid']} AND perm_owner >= 2) OR ";
$perms .= "(group_id IN ($group_list) AND perm_group >= 2) OR ";
$perms .= '(perm_members >= 2) OR ';
}
$perms .= '(perm_anon >= 2)';
// pull only the stories the visitor is allowed to view
$sql = "SELECT title, sid FROM {$_TABLES['stories']} WHERE ";
if (isset($newstoriesinterval) AND (is_numeric($newstoriesinterval)) AND
($newstoriesinterval > 0)) {
$sql .= "(date >= (NOW() - INTERVAL {$newstoriesinterval} SECOND)) AND ";
}
$sql .= "(date <= NOW()) AND (draft_flag = 0) AND (tid='$topic_id') AND ($perms)
ORDER BY date DESC, sid DESC LIMIT $num_stories";
$result = DB_query($sql,0);
$numrows = DB_numRows($result);
// continue on only if there is data to process
if ($numrows >= 1) {
// pull each story this particular topic
for ($count = 0; $count < $numrows; $count++) {
$row = DB_fetchArray($result);
$story_title = $row['title'];
$sid = $row['sid'];
// shorten the story's title if it's too long to fit nicely in the space
if (isset($max_title_length) AND is_numeric($max_title_length)) {
$title_length = strlen($story_title);
if ($title_length > $max_title_length) {
$story_title = substr($story_title, 0, ($max_title_length - 3));
$story_title = str_replace('$', '$', $story_title) . '...';
$story_title = str_replace(' ', ' ', $story_title);
}
} // end if
// display the title with url for each story
$display .= '<a href="' . $_CONF['site_url'] . '/article.php?story='
. $sid . '">' . $story_title . '</a><br />';
} // end for
} // end if
// return output to display
return $display;
} // end function Headlines
?>
Step 1: Put the function below in a file and name it headlines.php and place it somewhere on your server. Adjust the configuration variables if desired.
Step 2: Put these two lines at the very top of your file and adjust the paths so they point to where these files are located relative to your other one:
require_once('lib-common.php');
include_once('headlines.php');
Step 3: Call the below function (one or more times) wherever you want the headlines to display for a topic on your page. Like this:
$display = Headlines('Geeklog');
echo($display);
or
echo(Headlines('Geeklog'));
Replace the word Geeklog here with the topic id you want displayed. Be sure each time you call this function that it falls between
Text Formatted Code
<?php and ?>Text Formatted Code
-------------------------------------------------------------------------------
<?php
function Headlines($topic_id)
{
global $_TABLES, $_GROUPS, $_USER;
/***************************************************************************/
/* Set these configuration variables to meet your website's requirements */
/***************************************************************************/
// maximum number of stories to display under each topic.
$num_stories = 3;
// if you want to display stories only within a certain time interval, then
// uncomment and set this variable to the desired time frame. If set to zero
// or if left commented out, all stories will be displayed up to the max number
// desired ($num_stories) regardless of time period.
// $newstoriesinterval = 86400; // this time is in seconds (86400 = 24 hours)
// maximum number of characters to display in a story's title
$max_title_length = 20;
/****************************************************************************/
/* Please do not modify the code below unless you know what you are doing */
/****************************************************************************/
// initialize variables
$display = '';
$group_list = '';
$perms = '';
// return empty string if variables are not set properly or user has no access
if (!isset($topic_id) OR (sizeof($topic_id) < 1) OR
!isset($num_stories) OR !is_numeric($num_stories) OR
!SEC_hasTopicAccess($topic_id)) {
return $display;
}
// get a listing of all groups to which the visitor belongs
if (!empty($_USER['uid'])) {
foreach ($_GROUPS as $grp) {
$group_list .= $grp . ',';
}
$group_list = substr($group_list, 0, -1);
}
// set up the permission checker
if (!empty( $_USER['uid'])) {
$perms .= "(owner_id = {$_USER['uid']} AND perm_owner >= 2) OR ";
$perms .= "(group_id IN ($group_list) AND perm_group >= 2) OR ";
$perms .= '(perm_members >= 2) OR ';
}
$perms .= '(perm_anon >= 2)';
// pull only the stories the visitor is allowed to view
$sql = "SELECT title, sid FROM {$_TABLES['stories']} WHERE ";
if (isset($newstoriesinterval) AND (is_numeric($newstoriesinterval)) AND
($newstoriesinterval > 0)) {
$sql .= "(date >= (NOW() - INTERVAL {$newstoriesinterval} SECOND)) AND ";
}
$sql .= "(date <= NOW()) AND (draft_flag = 0) AND (tid='$topic_id') AND ($perms)
ORDER BY date DESC, sid DESC LIMIT $num_stories";
$result = DB_query($sql,0);
$numrows = DB_numRows($result);
// continue on only if there is data to process
if ($numrows >= 1) {
// pull each story this particular topic
for ($count = 0; $count < $numrows; $count++) {
$row = DB_fetchArray($result);
$story_title = $row['title'];
$sid = $row['sid'];
// shorten the story's title if it's too long to fit nicely in the space
if (isset($max_title_length) AND is_numeric($max_title_length)) {
$title_length = strlen($story_title);
if ($title_length > $max_title_length) {
$story_title = substr($story_title, 0, ($max_title_length - 3));
$story_title = str_replace('$', '$', $story_title) . '...';
$story_title = str_replace(' ', ' ', $story_title);
}
} // end if
// display the title with url for each story
$display .= '<a href="' . $_CONF['site_url'] . '/article.php?story='
. $sid . '">' . $story_title . '</a><br />';
} // end for
} // end if
// return output to display
return $display;
} // end function Headlines
?>
8
12
Quote
Status: offline
rawdata
Forum User
Full Member
Registered: 02/17/03
Posts: 236
I think one of Geeklog2's goals is to give the type of flexibility for which you're looking. Most CMS' today don't have this because they weren't designed with that in mind. I've only come across two so far which may come close to what you want. phpwebsite rewrote their code and built in a capability to move info around the page. The script is kinda slow though, and it hits the memory limitation (8 Megs) without having many blocks on a page. PostNuke has a couple add-ons which allow a person to place blocks in the center but I haven't played with these to see how good they are.
11
16
Quote
Anonymous
Anonymous
Well...Thanks! I'm trying your code...but have some questions:
I created newsheadline.php
I put include in libcommon.php
I tried to put php tag do view articles in header.thtml but it returns me an error
So you tried three news system...so what you suggest to me to obtain results I want?
Definitively (sorry if I'm boring you) is:
In the first page
left and right parts with my own links, no automated links
In the center that four boxes with last three articles (hope you code will work :=) )
Under four boxes, I would like to place (this is what I really want) link box, user connected box, survey...It must be there a way to extract a php code to write them wherever we want than activate or deactivate them from admin panel...
In the second page (contact page...article page...and so on) everything still the same...but the center now without those four boxes
Discovering this trick would be great for anyone I think...
Thanks again and again and again
Evol
:=)
I think I'm encountering all thes problems cause I always used rose from jinx and with it I was able to put content wherever I want
10
10
Quote
Status: offline
rawdata
Forum User
Full Member
Registered: 02/17/03
Posts: 236
What error message did you get when you tried executing php in header.thtml?
I'm not sure what you mean by the link box. If you mean the block containing the topics, this can be displayed by using the function COM_showTopics. The login/user function block can be displayed with the function COM_userMenu and the survey with the function COM_showPoll. All three of these are located in lib-common.php.
The admin panel only allows us to activate and deactivate blocks if they are located on the left or right sides of a page. It doesn't have the capability today to move these same blocks into the center area and activate/deactivate them there. Perhaps someone will take this on as a project.
12
11
Quote
All times are EST. The time is now 08:24 am.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content