Recent Topics

All your users forget to type the Title of the Post?

Started by on Mar 09, 2007 – Contents updated: Mar 09, 2007

Mar 09, 2007 02:35    

My b2evolution Version: 1.9.2
My Plugins: Autoblog
My Hacks: None

Well...

It happens to me a lot. I think that it would be a plus to have a window adverting the user that a Title should be entered, and then have the focus changed to the Title (with change of color - or "colour" , if you are British) after the user hit ok at the window.

Why are titles needed? Well it makes easier to look at your Summary. Did you repaired that if a post is saved without title all you get is a "2007-03-08: [en-EU]" without a link?

So, at this point, in my very personal opinion, I believe that there are two point to be analyzed:

a) whether use or not a window to advert the user of the necessity of typing a title (and making it mandatory) -> this is optional.

b) to make the links at the summary be populated differently. Like "<a href...user-date-title> user-date-title</a>" instead of the present "date <a href...title> title</a>" -> this is a real necessity.

Well, thats just an opinion...

Orator.

Mar 09, 2007 06:04

The summary page could also use the post_urltitle field in the event the post_title field is empty, which automagically gets something if there is no actual title. I think it gets "title" then "title_1" then "title_2" and so on up to forever. Something like that.

You could test an untested quickhack if you want. In your summary.php file find this:

			<li lang="<?php $Item->lang() ?>">
				<?php $Item->issue_date() ?>:
				<?php $Item->permanent_link( '#title#' ) ?>
				<span class="small">[<?php $Item->lang() ?>]</span>
			</li>


Now replace it with this:

			<li lang="<?php $Item->lang() ?>">
				<?php $Item->issue_date() ?>:
				<?php 
				if( $Item->title != '' )
				{
					$Item->permanent_link( '#title#' );
					} else {
					$quickurl = $Item->get_permanent_url();
					$faketitle = $Item->urltitle;
					$quicklink = '<a href="'.$quickurl.'" title="'.$faketitle.'">'.$faketitle.'</a>';
					echo $quicklink;
				} ?>
				<span class="small">[<?php $Item->lang() ?>]</span>
			</li>


No promises that it'll work. I'm sober, and none of this stuff makes sense when that happens to be the situation.

Sometimes blogs don't use post titles intentionally. It seems odd, but, depending on what the user is doing with their blog and skin it's possible they don't want a title. Prompting that you don't have one before saving would be neat, but forcing one to exist wouldn't be cool.

Mar 09, 2007 15:30

There is no truth in the universe, only point of views...

Prompting that you don't have one before saving would be neat, but forcing one to exist wouldn't be cool.

Looking in the perspective of a unique user owner of the blog (or a user in a multi-user blog) I agree with you, but looking in the perspective of a zealous admin who owns a multiblog system and want to know whats happening in his system (I deleted many users who were using the blog for scam or other illegal activities, including pedophiles), you could reach other "truths".

So, its always depends. But is clear that not always you can have all at the same time. My opinion? That should be an admin option. If you want, you force, if not, you can make it too.

On what regards your quick-hack, I didn't tested it yet, but lets analyze the most important portion of it:

      $quickurl = $Item->get_permanent_url();
               $faketitle = $Item->urltitle;
               $quicklink = '<a href="'.$quickurl.'" title="'.$faketitle.'">'.$faketitle.'</a>';

Isn't that creating the same problem? Because if .$faketitle.' is the title given by the user, and if the title is empty, ergo the link won't happen to exist... Am I wrong? ;)

What about this:

         <li lang="<?php $Item->lang() ?>">
            <?php $Item->issue_date() ?>:
            <?php
            if( $Item->title != '' )
            {
               $Item->permanent_link( '#title#' );
               } else {
               $quickurl = $Item->get_permanent_url();
               $faketitle = $Item->urltitle;
               $quicklink = '<a href=" '.$quickurl.' " title="'.$faketitle.'">  '.$quickurl' - '.$faketitle.'</a>';
               echo $quicklink;
            } ?>
            <span class="small">[<?php $Item->lang() ?>]</span>
         </li> 

Or maybe a simpler solution, would be using a symbol or a graphic to be used always that the link is empty:

<li lang="<?php $Item->lang() ?>">
            <?php $Item->issue_date() ?>:
            <?php
            if( $Item->title != '' )
            {
               $Item->permanent_link( '#title#' );
               } else {
               $quickurl = $Item->get_permanent_url();
               $faketitle = $Item->urltitle;
               $quicklink = '<a href="'.$quickurl.'" title="'.$faketitle.'"> * '.$faketitle.'</a>';
               echo $quicklink;
            } ?>
            <span class="small">[<?php $Item->lang() ?>]</span>
         </li> 

That way, even if the title is empty, if you rollover your mouse over the "*" (or whatever you prefer), you'll get the at least the url.

Well, I confess that I had no time yet to test neither of the coding, but as soon I do I'll post here my conclusions. Any ideas are welcome.

Orator

Mar 09, 2007 16:14

orator wrote:

Isn't that creating the same problem? Because if .$faketitle.' is the title given by the user, and if the title is empty, ergo the link won't happen to exist... Am I wrong? ;)

Yes. I just tested it and it works as advertised. urltitle is not the post title. urltitle will always have something - even if the post title is left blank. For the record, urltitle will also convert capital letters to lower case, and punctuation and spaces to underscores.

orator wrote:

What about this:

(snip)

That too will work, since I just tested it, but your "effective title" becomes extremely long.

orator wrote:

Or maybe a simpler solution, would be using a symbol or a graphic to be used always that the link is empty:

(snip)

That way, even if the title is empty, if you rollover your mouse over the "*" (or whatever you prefer), you'll get the at least the url.

You could use an image if you want, but urltitle is never empty so you will always have some text available if the post title field is blank.

$faketitle = '<img src="http://domain.com/path/to/images/imagename.png" width="80" height="15" />';

One might want to replace "faketitle" with a generic message instead of an image or the urltitle text. The urltitle is very plain if the post title is left blank. Literally it is "title". BORING! Therefore one might use something like

$faketitle = 'Another post with no title';

I betcha a dedicated blogger could even figure out the main category of the post and use it as part of the replacement text. That's a wee bit more dedicated than I feel like doing right now though. But I'm quite certain it is completely reasonable to do.

No matter what option you choose to create text for a post with no title, the core of the hack is valid.

Mar 09, 2007 16:53

Using the category name wasn't as easy as I figured, but it's workable. Check this out!

				<li lang="<?php $Item->lang() ?>">
				<?php $Item->issue_date() ?>:
				<?php
				if( $Item->title != '' )
				{
					$Item->permanent_link( '#title#' );
					} else {
					$quickurl = $Item->get_permanent_url();
					echo '<a href="'.$quickurl.'" title="This post doesn\'t have a title :(">This is a post without a title in the <strong>';
					$Item->main_category();
					echo '</strong> category</a> ';
				} ?>
				<span class="small">[<?php $Item->lang() ?>]</span>
				</li>

Mar 14, 2007 02:19

Hi,

I tested your last code, and seems to be a good solution.

But I would be even happier if that idea of creating a window to remind users to type a title was included (together with this change) .

Is Mr. Planque or Blueyed aware of it?

Orator

Mar 18, 2007 17:37

I may well be missing the point but it seems to me that what your asking for is a Javascript Alert box to be added in the ACP that simply checks if the Title input field has been filled in before a Post Save can be executed.
I'm not sure which files need editing but the title field has a name and id of "post_title" so it's just a matter of adding something like a

onsubmit="return validateForm(this)

to the "form action" and a JS function something like

//This Post needs a TITLE!.
       function validateForm(formobj) {
    if (formobj.post_title.value == '') {
        alert('Please enter a TITLE!');
        formobj.post_title.focus();
        return false;
    }
         return true;
}


Maybe one of the gurus can expand on this further


Form is loading...

b2evolution CMS – This forum is powered by b2evolution CMS, a complete engine for your website.