Welcome, Guest. Please login or register.
January 06, 2009, 08:38:44 AM

Login with username, password and session length
Search:     Advanced search
Website Baker 2.7.0 (stable) veröffentlicht!
Nähere Informationen findet ihr hier.
Das Diskussionsboard findet ihr hier.
71097 Posts in 11245 Topics by 6867 Members
Latest Member: sababa
* Home Help Search Login Register
+  Website Baker Community Forum
|-+  English
| |-+  Modules (Moderators: Argos, ruebenwurzel, BerndJM)
| | |-+  News-XTD module (items with visibility dates)
Pages: [1] 2 Go Down Print
Author Topic: News-XTD module (items with visibility dates)  (Read 7742 times)
pcwacht
Guest
« on: June 13, 2005, 11:04:48 PM »

(Did search this forum, didn't find the answers I needed, if I overlooked them... sorry Wink )

Running a website (intranet) for school, I need to place content items with visibility dates.

With this code : https://www.websitebaker.org/forum/viewtopic.php?t=409 or this https://www.websitebaker.org/forum/viewtopic.php?t=721 I can get the news from a group on a page, adding some php to it so it will check for the dates.
Next I need is adding dates with news items, example
today = let's say 1st july, need to publish the news item from 15 july to 15 august
Then I would need to add those dates with the news items. First one is visible from, last one is visible till. When first not set it will be visible from start, when last not set it will be visible till the end.

Could anyone point me to the files where I could start adding this to the news mod?
Other question, is there a way to duplicate the news mod to another named mod so I can tinker with that one instead, maybe release it as a new mod?

Thanks in advance

John
Logged
pcwacht
Guest
« Reply #1 on: June 14, 2005, 01:17:17 PM »

Basicly the above is divided into 2 diff tasks

1 - clone a module
2 - enhance a module

1 is done
Was quit easy, copied all the files from module/news
changed all database tables in all files
changed all path instances in all files
zipped it, installed it, tested it.

2 halfway done
- added vis_from and vis_till (visible from and untill) in table ..._posts
- added from and to fields (visibility dates) in post entry form
tested it, that worked

next to do:
- include date-fields for includion/exclusion in view and search routine
- add easy picking dates routine for the both vis_ fields

Fedit: MOVED
Logged
pcwacht
Guest
« Reply #2 on: June 14, 2005, 10:03:47 PM »

The NEWSXTD (news-extended) module is allmost done.

Think I have got it... just a wee point to solve.
Making sure the search won't bring the 'not-visible'-items up

Please give me some input on the search, how to exclude not-visible items
and input / comments on the stuff I have done so far.

I have used a datepicker for easy selection of dates (and making sure the dateformat is allways the same Wink ) I have used this one wich is fully GNU LGPL : http://www.dynarch.com/projects/calendar/.

Download of preview of newsxtd module is at : http://www.pcwacht.nl/newsxtd.zip


I have setup a demosite at http://puppets.mine.nu
You can get a login when you pm me.

Have fun!
Logged
pcwacht
Guest
« Reply #3 on: June 14, 2005, 11:54:48 PM »

Still searching for the search routine update so it won't show the non-visible items...

But.....

I didn't like the ' Read More ' thing when the news item had no long text (no body).
So I changed it Wink

When there is no long (or body) text it won't show the Read More link anymore.
Logged
valerie
Senior Baker
*****
Offline Offline

Posts: 156


WWW
« Reply #4 on: June 28, 2005, 07:54:40 PM »

Quote from: pcwacht

I didn't like the ' Read More ' thing when the news item had no long text (no body).
So I changed it Wink

When there is no long (or body) text it won't show the Read More link anymore.


Thanks for your work on this mod. I'm trying it out and I installed it and everything works great except I still get the "Read More" link. I didn't add anything to the long text field, just the short text. Did I miss something else that I need to do?

Thanks.
Logged

http://www.robcomm.net
--editing and proofreading for American English
--print and web publication management
--graphic and web design, including original photography
pcwacht
Guest
« Reply #5 on: June 28, 2005, 10:17:19 PM »

It was just a minor change I made after zipping it up, sorry.

I have rezipped the lot, please down it again and uninstall  and re-install the mod or just overwrite the view.php



Cheers,
John
Logged
Woudloper
Guest
« Reply #6 on: June 28, 2005, 10:32:04 PM »

Nice module. I am testing it out right now. The thing I am wondering if you are going to extend some more functions for this news module?

In the other thread someone suggested a feature to limit the output to a certain range. Would it be possible to add something like this to the 'settings' section of the extended module?

Furthermore would it be possible to disable/enabling showing the author of the post?
Logged
fienieg
Guest
« Reply #7 on: June 28, 2005, 11:12:11 PM »

Quote from: Woudloper
Furthermore would it be possible to disable/enabling showing the author of the post?


Showing the author name can be changed when pressed on the news page, and then settings and then changing the css display code
Logged
Olli
Senior Baker
*****
Offline Offline

Posts: 184


« Reply #8 on: October 22, 2005, 12:02:20 PM »

@pcwacht: thanks for your work! this is exactly what i need.
you need to tweak the way of searching for visible / invisible items?
i'm going to look at the code this weekend. maybe i can help you if you want me to.

bye

just a quick note:
on line 53 of save_post.php it says:
Code:
if ($vis_till = "0000-00-00") { ...

it has to be
Code:
if ($vis_till == "0000-00-00") { ...

right?
i'm a bit confused right now Wink

bye
« Last Edit: October 22, 2005, 12:41:15 PM by Olli » Logged
pcwacht
Guest
« Reply #9 on: October 22, 2005, 12:44:05 PM »

You are right about both things

the if .. == .. is the right one, stupid I have missed it Wink

and the search still searches for items wich visibility are out of current date.

Just made it in my earlt WB days to see how modules etc are made.

If you can solve the search thing the module could be upgraded to stable Wink



John
Logged
Olli
Senior Baker
*****
Offline Offline

Posts: 184


« Reply #10 on: October 22, 2005, 12:50:57 PM »

hi john,
sorry, but what search do you exactly mean by the way? Smiley do you mean the global site search?

unfortunately i have to leave now, so i'll try it this evening or tomorrow. i'll tell you about it then,ok? Smiley

have a nice weekend Smiley

bye
« Last Edit: October 22, 2005, 12:53:34 PM by Olli » Logged
pcwacht
Guest
« Reply #11 on: October 22, 2005, 01:41:44 PM »

Each module has it's own search routine wich is embedded in the global search (in the mysql table)

Need to figure a way so search will not find the invisible items.

John
Logged
Olli
Senior Baker
*****
Offline Offline

Posts: 184


« Reply #12 on: October 23, 2005, 01:25:17 PM »

hello john,
i think i have to to throw in the towel. i messed around with those search querys for 2 days now with no success Sad

but it think using the mysql-function curdate() in some way could be a solution. i'm sorry i can't help you  undecided
Logged
pcwacht
Guest
« Reply #13 on: October 23, 2005, 02:46:16 PM »

Ah well, you can allways disable the search .... Wink
Logged
Olli
Senior Baker
*****
Offline Offline

Posts: 184


« Reply #14 on: October 24, 2005, 02:41:05 PM »

ah yeah that's right, but maybe there is a better programmer than me out there willing to help? i would LOVE to see this module fixed Wink

please if anybody can: fix this isssue Smiley

best wishes,
olli
Logged
pcwacht
Guest
« Reply #15 on: October 24, 2005, 03:36:24 PM »

There is a query in the module wich works. It is in the view page. This query only show visible items.

I just don't know how to integrate this into the search routine....
view.php line: 97
Code:
$vis_today = date("Y-m-d");
$query_total_num = $database->query("SELECT post_id FROM ".TABLE_PREFIX."mod_newsxtd_posts WHERE vis_from <= '$vis_today' AND vis_till >= '$vis_today' AND section_id = '$section_id' AND active = '1' AND title != ''$query_extra" );
$total_num = $query_total_num->numRows();

John
Logged
Olli
Senior Baker
*****
Offline Offline

Posts: 184


« Reply #16 on: October 25, 2005, 09:16:13 PM »

hey john,
i'll look at it once more this week.

i can't stand this defeat Wink
Logged
pcwacht
Guest
« Reply #17 on: October 25, 2005, 09:38:34 PM »

Me neither.... but I must prioratize stuff since my days are only this long.....

I will eventually get to this one again.. Smiley

Dunnoh if you are good at php, one other minor issue is kinda bugging me.
If you search for text from the news long text, the found page is allways the news page
Imagine dozens of news posts.....

Allso on low on my priority list .

John (who allso dislikes pc related defeats)
Logged
pcwacht
Guest
« Reply #18 on: October 25, 2005, 09:49:05 PM »

Hmmm the Not Actives allso show up??

Logged
pcwacht
Guest
« Reply #19 on: October 25, 2005, 10:26:48 PM »

I won.

try this in search -> querybody (for the news_xtd that is!)


Code:
[TP]pages.page_id = [TP]mod_newsxtd_posts.page_id AND [TP]mod_newsxtd_posts.title LIKE '%[STRING]%' AND (
CURDATE( )
BETWEEN [TP]mod_newsxtd_posts.vis_from
AND [TP]mod_newsxtd_posts.vis_till
)
OR [TP]pages.page_id = [TP]mod_newsxtd_posts.page_id AND [TP]mod_newsxtd_posts.short LIKE '%[STRING]%' AND (
CURDATE( )
BETWEEN [TP]mod_newsxtd_posts.vis_from
AND [TP]mod_newsxtd_posts.vis_till
)
OR [TP]pages.page_id = [TP]mod_newsxtd_posts.page_id AND [TP]mod_newsxtd_posts.long LIKE '%[STRING]%' AND (
CURDATE( )
BETWEEN [TP]mod_newsxtd_posts.vis_from
AND [TP]mod_newsxtd_posts.vis_till
)
OR [TP]pages.page_id = [TP]mod_newsxtd_comments.page_id AND [TP]mod_newsxtd_comments.title LIKE '%[STRING]%' AND (
CURDATE( )
BETWEEN [TP]mod_newsxtd_posts.vis_from
AND [TP]mod_newsxtd_posts.vis_till
)
OR [TP]pages.page_id = [TP]mod_newsxtd_comments.page_id AND [TP]mod_newsxtd_comments.comment LIKE '%[STRING]%' AND (
CURDATE( )
BETWEEN [TP]mod_newsxtd_posts.vis_from
AND [TP]mod_newsxtd_posts.vis_till
)
OR [TP]pages.page_id = [TP]mod_newsxtd_settings.page_id AND [TP]mod_newsxtd_settings.header LIKE '%[STRING]%' AND (
CURDATE( )
BETWEEN [TP]mod_newsxtd_posts.vis_from
AND [TP]mod_newsxtd_posts.vis_till
)
OR [TP]pages.page_id = [TP]mod_newsxtd_settings.page_id AND [TP]mod_newsxtd_settings.footer LIKE '%[STRING]%' AND (
CURDATE( )
BETWEEN [TP]mod_newsxtd_posts.vis_from
AND [TP]mod_newsxtd_posts.vis_till
)
OR [TP]pages.page_id = [TP]mod_newsxtd_settings.page_id AND [TP]mod_newsxtd_settings.post_header LIKE '%[STRING]%' AND (
CURDATE( )
BETWEEN [TP]mod_newsxtd_posts.vis_from
AND [TP]mod_newsxtd_posts.vis_till
)
OR [TP]pages.page_id = [TP]mod_newsxtd_settings.page_id AND [TP]mod_newsxtd_settings.post_footer LIKE '%[STRING]%' AND (
CURDATE( )
BETWEEN [TP]mod_newsxtd_posts.vis_from
AND [TP]mod_newsxtd_posts.vis_till
)
OR [TP]pages.page_id = [TP]mod_newsxtd_settings.page_id AND [TP]mod_newsxtd_settings.comments_header LIKE '%[STRING]%' AND (
CURDATE( )
BETWEEN [TP]mod_newsxtd_posts.vis_from
AND [TP]mod_newsxtd_posts.vis_till
)
OR [TP]pages.page_id = [TP]mod_newsxtd_settings.page_id AND [TP]mod_newsxtd_settings.comments_footer LIKE '%[STRING]%' AND (
CURDATE( )
BETWEEN [TP]mod_newsxtd_posts.vis_from
AND [TP]mod_newsxtd_posts.vis_till
)
OR [TP]pages.page_id = [TP]mod_newsxtd_settings.page_id AND [TP]mod_newsxtd_settings.comments_footer LIKE '%[STRING]%' AND (
CURDATE( )
BETWEEN [TP]mod_newsxtd_posts.vis_from
AND [TP]mod_newsxtd_posts.vis_till
)

The code wich does the trick is :
AND ( CURDATE( ) BETWEEN [TP]mod_newsxtd_posts.vis_from AND [TP]mod_newsxtd_posts.vis_till )

I know it can be done way smoother, but this is the start.

Hope this gives you the boost to tinker some more ?
Things need to be done, clean up that search code, it is way too much, searching in headers and footers
Include the active from post, so the search won't show inactive's


Happy baking!
John
Logged
Pages: [1] 2 Go Up Print 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!