Welcome, Guest. Please login or register.
Did you miss your activation email?
May 16, 2012, 09:47:38 PM

Login with username, password and session length
Search:     Advanced search
Interested in joining the WebsiteBaker team?
For more Information read here or on our new website.
155094 Posts in 21661 Topics by 7721 Members
Latest Member: arrow345
* Home Help Search Login Register
Pages: [1] 2   Go Down
Print
Author Topic: News-XTD module (items with visibility dates)  (Read 9536 times)
pcwacht
Guest
« on: June 13, 2005, 10: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, 12: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, 09: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, 10: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

Offline Offline

Posts: 156


WWW
« Reply #4 on: June 28, 2005, 06: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, 09: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, 09: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, 10: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

Offline Offline

Posts: 290


« Reply #8 on: October 22, 2005, 11:02:20 AM »

@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, 11:41:15 AM by Olli » Logged
pcwacht
Guest
« Reply #9 on: October 22, 2005, 11:44:05 AM »

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

Offline Offline

Posts: 290


« Reply #10 on: October 22, 2005, 11:50:57 AM »

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, 11:53:34 AM by Olli » Logged
pcwacht
Guest
« Reply #11 on: October 22, 2005, 12: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

Offline Offline

Posts: 290


« Reply #12 on: October 23, 2005, 12: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, 01:46:16 PM »

Ah well, you can allways disable the search .... Wink
Logged
Olli

Offline Offline

Posts: 290


« Reply #14 on: October 24, 2005, 01: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, 02: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

Offline Offline

Posts: 290


« Reply #16 on: October 25, 2005, 08: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, 08: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, 08:49:05 PM »

Hmmm the Not Actives allso show up??

Logged
pcwacht
Guest
« Reply #19 on: October 25, 2005, 09: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.v is_from AND [TP]mod_newsxtd_posts.v is_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
Olli

Offline Offline

Posts: 290


« Reply #20 on: October 26, 2005, 11:04:01 PM »

hey john,

you rule! Smiley

i tried "where vis_tll > curdate ()..." but this didn't seem to work... Sad

haven't had time to check it out yours yet, but believe me i will Smiley

what else do you need fixed in particular? you were talking about selecting the way of searching?
what do you think of setting the things to search (posts footer or header, comments header or footer etc.) in the admin panel by altering the search query in the mysql-search table?

bye
Logged
pcwacht
Guest
« Reply #21 on: October 27, 2005, 06:20:48 AM »

The search:

Make a newspage, make short text 'abcdef' and long text 'ghijklm'

search for 'ghijklm', WB will find the newspage when you click the link finded you'll get the page with the short intro, not the long text.

Didn't had time to dig in it.

About searching in footers and headers and comments etc.
Might be an option to change that.


Was only the finding of inactive and invisible items wich was really bothering me  Wink

And need to test it for wb260


John
Logged
Olli

Offline Offline

Posts: 290


« Reply #22 on: October 28, 2005, 01:52:20 PM »

hey john,

just trying the new search query (replaced query in database).
unfortunately i get this:

Code:
Fatal error: Call to a member function numRows() on a non-object in C:\apachefriends\xampp\htdocs\baker\search\search.php on line 235

this is exactly what i got when i was messing around with curdate() myself. did you chance anything else besides the search query in database'?
Logged
pcwacht
Guest
« Reply #23 on: October 28, 2005, 03:44:11 PM »

Nope (at least didn't think so....)


Will update the version I have and place the zip here
But will take some time, cause need to work from the news module from 260 to make it compatible with 260.

Expect in or right after this weekend.

John

here is my code again for the search table (all 4 entries!!), maybe I copied it wrong... ; )


[attachment deleted because of being too old]
Logged
Olli

Offline Offline

Posts: 290


« Reply #24 on: October 28, 2005, 04:36:52 PM »

hey john,

looking forward to that ZIP Smiley Smiley Smiley
i think i broke my search.php when trying to fix that search query...need to replace it i guess Wink
bye
« Last Edit: October 29, 2005, 12:52:19 PM by Olli » Logged
Pages: [1] 2   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!