Recent Topics

1 Jun 27, 2005 18:17    

I have a blog that displays funding opportunities by due date. Alas, some of these opportunities have no due date at all! I was wondering if anyone might help me modify the back office so that a user could enter 'none' or 'null' in the 'edit timestamp' dialogue.....say in the dropdown menu that displays the month. In effect this would just hide the 'posted date'.

Thank much, all your help is greatly appreciated.

johnnyeng

2 Jun 27, 2005 21:18

Ahem, but if you replace the month with some bogus value ... the system won't know what month the post was made. (You don't care, I know, but the system will need to know what ORDER to display the posts, if it's doing it chronologically).

You could, of course, add a radio button or check box that says to "hide due date" ... or you could have a separate "no due date" category, where ALL dates are hidden ... or maybe pick a specific TIME (like all posts with the time 13:13:13 ... don't display the date, which would be easy to do in the _main.php file for the skin, with just a

<?php if ($issue_date(h:m:s) != 13:13:13) { $Item->issue_date(format); }

the nice thing about this is that it doesn't involve a core file hack.

Anyway ... just some ideas. :D

Cheers,

-stk

3 Jun 27, 2005 22:10

Thanks for the response stk. :)
I really like the idea of providing a "hide due date" check box in the back office. Trouble is, I have not been able to get one to work...I keep blowing out the page.

I've been trying code it into /admin/_edit_form.php and playing with /admin/edit_actions.php in an attempt to change parameters. I've had no luck. I seem to be getting hung on the 'if' statement.

Do you have any suggestions?

Thanks much!

johnnyeng

4 Jun 27, 2005 22:19

As nice as it would be to have a check-box in the back office, personally I'd opt for the date deal, as I'm not big on core hacks. If given the choice, I'd rather have modifications to a _main.php associated with a skin, as you're not going to lose the functionality if/when you upgrade to a newer version. Just have to let users know that if they want to add a post that hides the issue_date ... just to use (some specific time).

Maybe you could post the code you've got and I could have a quick look at my setup, if you're keen on a back-office check box?

-stk

5 Jun 27, 2005 22:36

Hi again stk
I've added this to /admin/edit_actions.php


param( 'none', 'html' );
$none = 'None';

and this to /admin/_edit_form.php


<input type="checkbox" class="checkbox" name="none" value="<?php echo $none ?>" id="timestamp" tabindex="13"
				<?php	if ( $none ) { echo ' checked="checked"'; } ?> />
				<label for="non_sensitive"><strong><?php echo T_('Please Check if this entry is <em>non-time-sensitive</em>') ?></strong>.</label>

I've had no luck. I'm beginning to like your date idea. :)

johnnyeng

6 Jun 28, 2005 00:48

Here's the conclusion that I've come to ... adding a checkbox to the back office is easy. Then I can see that collecting the information (is the checkbox selected?) is easy enough to do in the edit_actions.php ...

BUT what do you do with it? Seems you're meant to create a new field in the DB to store this information for each entry. THEN ... if you don't want to have to run a mySQLquery in your _main.php for every post, to query the DB to determine if that new field is ON or OFF ... you'll need to create your own function for this data, so it can be called with an $Item->new_field and used in an IF statement in _main.php to supress the date.

ACK ... a lot of core hacking for a simple checkbox! 8|

(More work than I'd want to put in for sure, but maybe I'm just plain lazy?)

So ... what you can do instead, is add a line to the form, right below where the timestamp/date/time thing is and say "To supress the date/time ... make timestamp time 03:03:03" (what's the likelyhood that someone is blogging at 3AM and saves their blog entry at EXACTLY 3:03:03? ... not bloody likely, at least, not in my house!)

Then, in the _main.php file use this logic to supress any post with an issue_time of three minutes three seconds after three o'clock in the morning:

$supress = explode(" ",$Item->issue_date);
if ($supress[1] != "03:03:03") { 
$Item->issue_date (format u want);
$Item->issue_time('format u want'); 
}

One teeny core hack (the form) and yet, you retain the ability to supress the date/time for posts! Everybody happy? :D

-Scott

7 Jun 29, 2005 23:30

Thanks so much Steve,
this worked like a charm!

To get the desired ouput I modified the code just a bit:

<?php $supress = explode(" ",$Item->issue_date);
if ($supress[1] != "03:03:03"){
$Item->issue_date ('\D\u\e \d\a\t\e\: F j, Y');
} ?>

YAY!

johnnyeng

8 Jun 29, 2005 23:54

No problem, Paul! ;)

(It just sounds nicer, when people use your actual name! :D)

NBD ... and as a tidbit of information ... my grandfather's name was Steve! (So you're only two generations removed). :lol:

Glad it worked out. 3AM may not be a sexy way of doing it, but hey ... it works and it's easy!

-stk
(steve to you)

9 Jun 30, 2005 00:00

:oops:
Sorry Scott.
thanks again!

johnnyeng

11 Jun 30, 2005 19:43

At least I'm not the only one to make that mistake, Steve - er, uh, Scott.

:)

12 Jun 30, 2005 19:52

Yeah ... what's up with the whole "steve" thing? :lol:

Guess I must have an alter identity!


Form is loading...