Page 1 of 2

Apostrophe S

Posted: Tue Jun 27, 2006 11:15 pm
by suzukiman1980
Good day everyone.

I am a total Joomla! n00b but I have been recruited to build a website for my church. Everything has gone well until now but I've run into a problem I can't figure out.

I am creating a category called "Children's Ministries" under the section "Ministries". I have triple checked everything and nothing I do gets rid of the glitch. "Children's Ministries" appears as "Children/'s Ministries". Note the backslash before the apostrophe.

I have tried deleting the category and crating a new one and not even that solves the issue. Any suggestions?

Re: Apostrophe S

Posted: Tue Jun 27, 2006 11:18 pm
by Steve
Try turning of the editor in global Configurations  :)

Re: Apostrophe S

Posted: Tue Jun 27, 2006 11:31 pm
by suzukiman1980
Ok, changed the global config and no result. Same problem.

Re: Apostrophe S

Posted: Tue Jun 27, 2006 11:59 pm
by Steve
Did you redo the affected text?
What version of Joomla are you running?

Re: Apostrophe S

Posted: Wed Jun 28, 2006 12:13 am
by suzukiman1980
I totally rewrote the text. The only place I am having the problem is in the category name. When I type "Children's" in the text field for the body of the description I don't have any problem, it displays like it should.

I am using v1.08 with JCE as the text editor, but it makes no difference which editor I use.

Re: Apostrophe S

Posted: Wed Jun 28, 2006 12:32 am
by midwestkel
J! will automatically put that in the admin side since it is PHP driven you need to put a "/" in front of " ' " Thats normal and will not show the "/" on the front end.

If you need anything else please let us know.

Re: Apostrophe S

Posted: Wed Jun 28, 2006 12:53 am
by suzukiman1980
I've tried typing in "Children/'s", "Children\'s", "Children\s", "Children/s" with no positive results.

Result of "Children/'s" ----- "Children/\'s"
Result of "Children\'s" ----- "Children\\\'s"
Result of "Children\s" ----- "Children\\s"
Result of "Children/s" ----- "Children/s"

Any suggestions?

Re: Apostrophe S

Posted: Wed Jun 28, 2006 5:32 pm
by midwestkel
No just put


Children's


It will look like


Children/'s

on the admin side but on the front end it will look like the first one.

Re: Apostrophe S

Posted: Wed Jun 28, 2006 9:28 pm
by suzukiman1980
midwestkel wrote: No just put

Children's

It will look like

Children/'s

on the admin side but on the front end it will look like the first one.

It looks like Children\'s on both the front end and the back end. Here's what I'm looking at:

http://northshoreassembly.org/nsag2/ind ... &Itemid=36

Re: Apostrophe S

Posted: Wed Jun 28, 2006 10:45 pm
by Steve
Try upgrading to the latest version http://forum.joomla.org/index.php/topic,71966.0.html and see if that fixes it.
You only need to overwrite your files so it want affect the content you have entered.

Re: Apostrophe S

Posted: Wed Jun 28, 2006 11:35 pm
by midwestkel
I see what your saying I haven't had that problem and I am on 1.0.8

Re: Apostrophe S

Posted: Thu Jun 29, 2006 1:03 am
by suzukiman1980
Ok, I updated from 1.0.08 to 1.0.10 and what you see is still there. There seems to be some sort of glitch with the ' in any title. I tried it on another title and it did the same thing although it doesn't happen in the body of a paragraph.

Re: Apostrophe S

Posted: Thu Jun 29, 2006 5:29 pm
by midwestkel
Man beats me I tried to see if it would happen to me and it didnt. I would PM a moderator to see if they know about it.

Re: Apostrophe S

Posted: Thu Jun 29, 2006 8:01 pm
by suzukiman1980
I'll do that.

Odd, isn't it? I've never seen anything like it before.

Thx for your help. If I can get a resolution to the issue I will definately post it.

Re: Apostrophe S

Posted: Fri Jun 30, 2006 12:28 pm
by nathandiehl
see this link:
http://northshoreassembly.org/nsag2/ind ... &Itemid=40

there are five apostrophes here, and all look good--including three Children's Ministry that was in question.

Have you cleared teh cache? (from backend, system-->clear all cache  --if the option isn't there, it isn't enabled, which is okay)

If still an issue, i would recommend:
1. create a new, different category (same section as Children's Ministry)
2. copy all content items over from old category to new category
3. re-create menu item links to the new category, deleting old ones
4. delete old category.


hope this helps. certainly an odd issue.

Re: Apostrophe S

Posted: Fri Jun 30, 2006 6:06 pm
by suzukiman1980
nathandiehl wrote: see this link:
http://northshoreassembly.org/nsag2/ind ... &Itemid=40

there are five apostrophes here, and all look good--including three Children's Ministry that was in question.

Have you cleared teh cache? (from backend, system-->clear all cache  --if the option isn't there, it isn't enabled, which is okay)

If still an issue, i would recommend:
1. create a new, different category (same section as Children's Ministry)
2. copy all content items over from old category to new category
3. re-create menu item links to the new category, deleting old ones
4. delete old category.


hope this helps. certainly an odd issue.
I checked and the server cache option is off. I cleared my browser cache in both IE and Firefox again before viewing the pages that have the problem and I still see \'

I created a new Children's Ministries category, made new menu links, moved the content, and deleted the old category and the problem still exists. I'm out of ideas, aside from being grammatically incorrect and use "Childrens" instead of "Children's".

EDIT: I have tried adding a different category named "Men's Ministries" and I have the same problem. You can see it here:

http://northshoreassembly.org/nsag2/ind ... &Itemid=43

Re: Apostrophe S

Posted: Fri Jun 30, 2006 6:43 pm
by nathandiehl
can you duplicate what you're doing on the Demo site?
http://demo.joomla.org

Re: Apostrophe S

Posted: Fri Jun 30, 2006 11:38 pm
by suzukiman1980
Yes, it seems to be doing it on the demo site as well. I created a category under News named "NSAG's Test". See the screenshots below.

Image

Image

Re: Apostrophe S

Posted: Sun Jul 02, 2006 5:14 am
by codecontractor
I had the same problem and hacked a solution...

In components / com_content / content.html.php

lines 134 and 135 read:

Code: Select all

<a href="<?php echo $link; ?>" class="category">
	<?php echo $row->name;?></a>
This needs to be changed to:

Code: Select all

<a href="<?php echo $link; ?>" class="category">
	<?php echo stripslashes($row->name);?></a>
Is there a way to communicate this to the dev team to let them know because this is a change they should make to the release?

-Ben

One more hack

Posted: Sun Jul 02, 2006 5:34 am
by codecontractor
I noticed that the same problem occurs if you show the category below the title of a content item.

You just have to add the stripslashes function to this function at line 777.

joomla version: 1.0.10

Code: Select all

	/**
	* Writes Category
	*/
	function Category( &$row, &$params ) {
		if ( $params->get( 'category' ) ) {
			?>
			<span>
				<?php
				echo stripslashes($row->category);
				?>
			</span>
			<?php
		}
	}
I'll add here that I'm going to add a class to the span for my own use. I would recomend it for customization in the future.

Re: Apostrophe S

Posted: Sun Jul 02, 2006 1:06 pm
by suzukiman1980
Well, that got me closer!!

I'm still having problems with the category name when it displays the content items in the category. See screenshot below:

Image

I appreceate the help you're giving me. Any other ideas? I have never seen anything be this stubborn before!

Re: Apostrophe S

Posted: Sun Jul 02, 2006 6:37 pm
by codecontractor
I can't seem to duplicate that problem myself. Are you sure you haven't got the slash in the title itself?

You can try the following hack at line 44 of the same file:

Code: Select all

		if ( $params->get( 'page_title' ) ) {
			?>
			<div class="componentheading<?php echo $params->get( 'pageclass_sfx' ); ?>">
			<?php echo stripslashes($title->name); ?>
			</div>
			<?php
		}
Once again the version is 1.0.10.

I hope that works.

Re: Apostrophe S

Posted: Sun Jul 02, 2006 8:12 pm
by suzukiman1980
codecontractor wrote: I can't seem to duplicate that problem myself. Are you sure you haven't got the slash in the title itself?

You can try the following hack at line 44 of the same file:

Code: Select all

		if ( $params->get( 'page_title' ) ) {
			?>
			<div class="componentheading<?php echo $params->get( 'pageclass_sfx' ); ?>">
			<?php echo stripslashes($title->name); ?>
			</div>
			<?php
		}
Once again the version is 1.0.10.

I hope that works.



BINGO!!!!  :D

Ben, you nailed it!!!! That was the final solution to remove the slash. Truely I am in the presence of greatness!

Thank you so much. You da man!

Re: Apostrophe S

Posted: Sun Jul 02, 2006 9:45 pm
by sashen
CodeContractor....

Thanks so much ... I made the changes you suggested (at least I think I did), but I'm still having ONE problem:

1) Hover over "Keyword Article 1's" (where you see one of the places the solution IS working) and you'll see this path:

http://recreationdigest.com/recreation' ... e-1's.html

"recreation-travel's" is the category. (recreation's is the section)...

Here's what I think is the relevant code section:

Code: Select all

	/**
	* Writes Section
	*/
	function Section( $row, $params ) {
		if ( $params->get( 'section' ) ) {
				?>
				<span>
				<?php
				echo stripslashes($row->section);
				// writes dash between section & Category Name when both are active
				if ( $params->get( 'category' ) ) {
					echo ' - ';
				}
				?>
				</span>
			<?php
		}
	}

	/**
	* Writes Category
	*/
	function Category( $row, $params ) {
		if ( $params->get( 'category' ) ) {
			?>
			<span>
			<?php
			echo stripslashes($row->category);
			?>
			</span>
			<?php
		}
	}
Any hints?

THANKS!


(oh, I'm using 1.0.8 )

Re: Apostrophe S

Posted: Mon Jul 03, 2006 2:13 pm
by azorn
The problem is further upstream.

I have exactly the same problem (maybe Joomla doesn't like Children's Ministries  ;)).  Creating a new category didn't solve the problem, I had the same thing happen again.

When I look in the database, jos_categories table, I found the title was stored as "Children\'s Ministries".  Going in and taking out the backslash in the data solved the problem. 

Of course, you don't want to be doing that all the time, but it says to me that somewhere there are too many addslashes before the title gets stored - "Children's" gets changed to "Children\'s" correctly but then, somehow that gets changed to "Children\\\'s" before the text is written to the database. 

FWIW, I also tried deleting the category  when it still had content and I got an error message that "Children\\\\\\\'s Ministry" still had content - talk about addslash overload!

I also see that categories created by DocMan don't have the extra slash.  Maybe there's a hint in there.

I'll try to hunt around in the source, but I thought I'd toss this out to those who know their way around it a little better.

Apostrophe in URL

Posted: Mon Jul 03, 2006 3:57 pm
by codecontractor
Sashen,

What SEO tool are you using? It's obviously not the standard SEF links because those are written:

content/category/1/1/2/

It sounds like the problem is in the tool that generates the links...

-Ben

Re: Apostrophe in URL

Posted: Mon Jul 03, 2006 4:25 pm
by sashen
codecontractor wrote: Sashen,

What SEO tool are you using? It's obviously not the standard SEF links because those are written:

content/category/1/1/2/

It sounds like the problem is in the tool that generates the links...

-Ben
I'm using SEF Advance.

I don't think that's causing the problem since the solution codecontractor gave worked everywhere but that ONE place... it worked in the Section part of the URL link, e.g.

-Sashen

The problem is in SEF Advance

Posted: Mon Jul 03, 2006 5:01 pm
by codecontractor
The code I edited above solved the problem within the content component of the site. This doesn't solve the problem when it comes to SEF links. This is because of a function called sefRelToAbs:

Code: Select all

/**
 * Converts an absolute URL to SEF format
 * @param string The URL
 * @return string
 */
function sefRelToAbs( $string )
You may notice it is called above. This function strips the GET text from the url and converts it to SEF format (with /'s).

I don't know, but I assume that the SEF Advance component overrides this function and then queries the database for the names associated with the ID's of the categories, sections, and content items. I'm not going to pay 40 quid to check for you though.  :-\

Anyway, the com_content component doesn't write the SEF url. SEF Advance does and gets the category name directly from the DB so the stripslashes function is missing somewhere in Emir Sakic's code. I suggest you bring it up with him.

-Ben

Re: Apostrophe S

Posted: Mon Jul 03, 2006 11:52 pm
by codecontractor
Ok, well I see part of the problem...

In the DB apostrophes are handled differently between categories and sections.

That is, if you create a new Section with an apostrophe in it there are no slashes in the jos_sections table, but if you create a new Category with an apostrophe it is stored as /' in the jos_categories table. They do this explicitly in the code for categories, but not for Sections and I haven't been able to figure out why. Things seem to work fine if you remove the apostrophes in the DB though.

I've made a small change in administrator/components/com_categories/admin.categories.php

Code: Select all

/**
* Saves the catefory after an edit form submit
* @param string The name of the category section
*/
function saveCategory( $task ) {
....
....
// 	$row->title 		= addslashes( $row->title );
// 	$row->name		= addslashes( $row->name );
	$row->title 		= $row->title;
	$row->name		= $row->name;
This stops the category from being saved in the DB with the slash. I've tested this a little, but I can't guarantee that this doesn't seriously damage the system... ???

I would recommend going directly into your db and adjusting the jos_categories table to remove the /' in title and name to test things first. Then, if your site still works, make the changes in the code.

I would also recommend uninstalling/reinstalling SEF Advance -- and I don't know why, but that worked for me on my test system.

-Ben

joomla version: 1.0.10

Re: Apostrophe S

Posted: Tue Jul 04, 2006 12:45 am
by Zardoz
Hi, glad I ran across this thread. I noticed the same issue with apostrophes before and simply changed the name of the catagory so it didn't use an apostrophe.  :( (Not very technical, I know, but I'm really uncomfortable messing with code.) I simply named it back to recreate the issue.

In case this is of help, I'm not using any SEF other than Joomla's built-in version.

Joomla! version 1.0.8
Community Builder
JCE
Joomap
JoomlaBoard
JoomlaExplorer

Sorry, but the code hacking thing is way over my head.

HTH