|
All times are UTC |
|
|
Page 2 of 2 |
[ 17 posts ] | Go to page Previous 1, 2 |
| Print view | Previous topic | Next topic |
| Author | Message |
|---|---|
|
Joined: Fri Jan 25, 2008 4:53 pm Posts: 15 |
Hi,
i have a little question: I found these linies in my utils.php $output = str_replace("\"", "", $output); $output = str_replace("--", "", $output); $output = str_replace("'", "", $output); $output = str_replace('"', '', $output); $output = str_replace('&', '_', $output); $output = str_replace('/', '_', $output); $output = str_replace('!', '', $output); $output = str_replace('?', '', $output); $output = str_replace('$', '', $output); Must I only relpace "$output = str_replace("\"", "", $output);" or the whole block with: $output = str_replace(" - ", "-", $output); $output = str_replace("_", "-", $output); $output = str_replace("---", "-", $output); $output = str_replace("\"", "", $output); $output = str_replace("--", "-", $output); thx for the help Greets Olli |
| Mon Jan 28, 2008 9:45 am |
|
|
Site Admin Joined: Wed Dec 12, 2007 9:34 pm Posts: 296 |
Hi mog,
What version of pligg are you using? In v9.9.0 the whole code part you are looking for in /libs/utils.php looks like below. Code: function makeUrlFriendly($input) { global $db; //$input = remove_error_creating_chars($input); $output = utf8_substr($input, 0, 240); $output = trim($output); $output = html_entity_decode(htmlentities($output, ENT_COMPAT, 'UTF-8')); $output = preg_replace("/\s/e" , "_" , $output); // Replace spaces with underscores $output = str_replace("--", "-", $output); $output = str_replace("/", "", $output); $output = str_replace("\\", "", $output); $output = str_replace("'", "", $output); $output = str_replace(",", "", $output); $output = str_replace(";", "", $output); $output = str_replace(":", "", $output); $output = str_replace(".", "-", $output); $output = str_replace("?", "", $output); $output = str_replace("=", "-", $output); $output = str_replace("+", "", $output); $output = str_replace("$", "", $output); $output = str_replace("&", "", $output); $output = str_replace("!", "", $output); $output = str_replace(">>", "-", $output); $output = str_replace(">", "-", $output); $output = str_replace("<<", "-", $output); $output = str_replace("<", "-", $output); $output = str_replace("*", "", $output); $output = str_replace(")", "", $output); $output = str_replace("(", "", $output); $output = str_replace("[", "", $output); $output = str_replace("]", "", $output); $output = str_replace("^", "", $output); $output = str_replace("%", "", $output); $output = str_replace("»", "-", $output); $output = str_replace("|", "", $output); $output = str_replace("#", "", $output); $output = str_replace("@", "", $output); $output = str_replace("`", "", $output); $output = str_replace("”", "", $output); $output = str_replace("“", "", $output); $output = str_replace("\"", "", $output); if(function_exists('utils_makeUrlFriendly')) { $output = utils_makeUrlFriendly($output); } // check to see if the story title already exists. If so, add an integer to the end of the title $n = $db->get_var("SELECT count(*) FROM " . table_links . " WHERE link_title_url like '$output%'"); if ($n > 0) { return $output . "-$n";} else { return $output; } } You want to replace the line.... Code: $output = str_replace("\"", "", $output); With the code i supplied on page 1 Hope that helps m8 |
| Tue Jan 29, 2008 4:04 pm |
|
|
Joined: Sun Jan 06, 2008 2:35 am Posts: 36 |
LincolnHawks wrote: bbrian017 wrote: I added the code, I don't see any errors but I also think I'm using URL method 1 If I switch it to method 2 will I see issues, http://www.blogengage.com Also this is a pre existing pligg 9.8.2 website! EDIT: Ok I said url 2 method and I got page not found but I'm assuming it's because the url wasn't created yet or doesn't exist. How do I go about making it so the url is there using SEO and Method 2. Do I need to also do the above suggestion ? Hi bbrian, I see you have used URL method 1 to begin with on your site Code: http://www.blogengage.com/story.php?title=The_IWH_Inquirer_Skin_Deep_a_breakthrough_for_Pluripotent_stem_cells the part of the url that says Code: The_IWH_Inquirer_Skin_Deep_a_breakthrough_for_Pluripotent_stem_cells is stored in the pligg database field link_title_url at the moment and this is where pligg fetches is safe URL structure from, therefore old urls even with this mod applied will still read _ instead of - as the information was submitted using the old structure before the mod was applied. A possible fix for this off the top of my head is to run a MYSQL query from phpMyAdmin that will affect the pligg_links table and the link_title_url field converting _ to -, best person to as is Ashdigg master of all things pligg on that one dude if it's even possible. Hope that helps man I miss read this the last time I was here! So I can use this mod and the old url will still be good but they won't be changed to the new url method? _________________ Search Engine | Social Networking for Bloggers | Better Affiliate Marketing | More Affiliate Marketing |
| Fri Apr 18, 2008 8:12 pm |
|
|
Site Admin Joined: Wed Dec 12, 2007 9:34 pm Posts: 296 |
Quote: I miss read this the last time I was here! So I can use this mod and the old url will still be good but they won't be changed to the new url method? yep thats what is likley to happen, all new urls submitted after the changes will have _ instead of _ also if you edit an old url the seperator will be changed to a -, thats somthing to keep in mind. Lincoln |
| Sun Apr 20, 2008 1:53 am |
|
|
Joined: Sun Jul 13, 2008 7:58 am Posts: 4 |
Hi i done the same thing as u instructed but i'm still getting '_' instead of '-'. Please help me out i'm including my code here please do check it and help me. I have installed pligg in the root folder. U check it here http://www.napkl.com
File 1 : .htaccess ##### Re-directing Begin ##### Options +Indexes +FollowSymlinks RewriteEngine on ## If Pligg is installed in a subfolder, change the below line to RewriteBase /name-of-subfolder RewriteBase / ## If installed in a subfolder you may need to add ## to the beginning of the next line RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/ ## Remove these two lines if you have a sub-domain like http://ashdigg.pligg.com or http://localhost ## Keep if your site it like http://www.pligg.com RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^\/?(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] ##### Re-directing End ##### ##### You can find the below lines pre-made for you in the category management section of the admin panel ###### RewriteRule ^(all|Science_Technology|Gadgets|Software|Mobiles|Security|News|WorldNews|RegionalNews|Gaming|PCGames|Xbox_Playsation|MobileGames|Entertainment|Celebrity|Movies|Music|Pictures|Sports|Cricket|Football|Tennis|OtherGames|Kinky|Comedy|OddStuff)/([^/]+)/?$ story.php?title=$2 [L] RewriteRule ^(all|Science_Technology|Gadgets|Software|Mobiles|Security|News|WorldNews|RegionalNews|Gaming|PCGames|Xbox_Playsation|MobileGames|Entertainment|Celebrity|Movies|Music|Pictures|Sports|Cricket|Football|Tennis|OtherGames|Kinky|Comedy|OddStuff)/?$ ?category=$1 [L] ##### FILE 2 : lib/utils.php function makeUrlFriendly($input) { global $db; //$input = remove_error_creating_chars($input); $output = utf8_strtolower($input, 0, 240); $output = trim($output); $output = html_entity_decode(htmlentities($output, ENT_COMPAT, 'UTF-8')); $output = preg_replace("/\s/e" , "_" , $output); // Replace spaces with underscores $output = str_replace("--", "-", $output); $output = str_replace("/", "", $output); $output = str_replace("\\", "", $output); $output = str_replace("'", "", $output); $output = str_replace(",", "", $output); $output = str_replace(";", "", $output); $output = str_replace(":", "", $output); $output = str_replace(".", "-", $output); $output = str_replace("?", "", $output); $output = str_replace("=", "-", $output); $output = str_replace("+", "", $output); $output = str_replace("$", "", $output); $output = str_replace("&", "", $output); $output = str_replace("!", "", $output); $output = str_replace(">>", "-", $output); $output = str_replace(">", "-", $output); $output = str_replace("<<", "-", $output); $output = str_replace("<", "-", $output); $output = str_replace("*", "", $output); $output = str_replace(")", "", $output); $output = str_replace("(", "", $output); $output = str_replace("[", "", $output); $output = str_replace("]", "", $output); $output = str_replace("^", "", $output); $output = str_replace("%", "", $output); $output = str_replace("»", "-", $output); $output = str_replace("|", "", $output); $output = str_replace("#", "", $output); $output = str_replace("@", "", $output); $output = str_replace("`", "", $output); $output = str_replace("”", "", $output); $output = str_replace("“", "", $output); $output = str_replace(" - ", "-", $output); $output = str_replace("_", "-", $output); $output = str_replace("---", "-", $output); $output = str_replace("\"", "", $output); $output = str_replace("--", "-", $output); if(function_exists('utils_makeUrlFriendly')) { $output = utils_makeUrlFriendly($output); } // check to see if the story title already exists. If so, add an integer to the end of the title $n = $db->get_var("SELECT count(*) FROM " . table_links . " WHERE link_title_url like '$output%'"); if ($n > 0) { return $output . "-$n";} else { return $output; } } function makeCategoryFriendly($input) { $input = utf8_substr($input, 0, 240); $output = trim($input); $output = html_entity_decode(htmlentities($output, ENT_COMPAT, 'UTF-8')); $output = preg_replace("/\s/e", "_", $output); // remove spaces $output = str_replace("_", "-", $output); $output = str_replace("-_-", "-", $output); $output = str_replace("--", "", $output); $output = str_replace("'", "", $output); $output = str_replace('"', '', $output); $output = str_replace('&', '-', $output); $output = str_replace('/', '-', $output); $output = str_replace('!', '', $output); $output = str_replace('?', '', $output); $output = str_replace('$', '', $output); $output = str_replace("---", "-", $output); $output = str_replace("--", "-", $output); if(function_exists('utils_makeUrlFriendly')) { $output = utils_makeUrlFriendly($output); } return urlencode($output); } function remove_error_creating_chars($chars) { $replace=array( 'Á' => 'A', 'Å' => 'A', 'ä' => 'a', 'á' => 'a2', 'à' => 'a3', 'â' => 'a4', 'ã' => 'a5', 'ä' => 'a', 'å' => 'a', 'æ' => 'ae', 'æ' => 'ae', 'é' => 'e', 'È' => 'E', 'É' => 'E', 'Ì' => 'I', 'ì' => 'i', 'Í' => 'I', 'í' => 'i', '¼' => '', '¾' => '', '¿' => '', 'ñ' => 'n', 'Ñ' => 'N', 'Ò' => 'O', 'ò' => 'o', 'Ö' => 'O', 'Õ' => 'O', 'Ó' => 'O', 'ô' => 'o', 'ó' => 'o', 'õ' => 'o', 'ö' => 'o', 'Š' => 's', 'š' => 's', 'Û' => 'U', 'Ú' => 'U', 'Ü' => 'U', 'û' => 'u', 'ú' => 'u', 'ü' => 'u', 'Ý' => 'Y', 'ý' => 'y', 'Ž' => 'Z', 'ž' => 'z', '€' => '' ); foreach ($replace as $key => $value) { $chars = str_replace($key, $value, $chars ); } return $chars; } function loghack($page, $extradata, $silent=false){ // This function will be used for logging hacking attempts. // you'd also want IP Address // - date / time // email or log to file if($silent == false){ die("Hacking attempt on ". $page); } } function checkforfield($fieldname, $table) { // checks to see if field exists in table $result = mysql_query('select * from ' . $table . ' LIMIT 1'); if (!$result) { echo "<HR />ERROR! The table " . $table . " is missing! Are you sure you should be doing an upgrade?<HR />"; return true; } $i = 0; while ($i < mysql_num_fields($result)) { $meta = mysql_fetch_field($result, $i); if (!$meta) { echo "No information available<br />\n"; } else { if(strtolower($meta->name) == strtolower($fieldname)){ return true; } } $i++; } return false; } function object_2_array($result, $cur_depth = 0, $depth_limit = 1000) { // $cur_depth and $depth_limit is used for php 4 only // prevents the function from doing extra checking to see if // it should 'explore' the object further. saves a few cpu cycles // using this because (array)$user will not work in php 4 $array = array(); if(isset($result)){ foreach ($result as $key=>$value) { if ($cur_depth < $depth_limit && is_object($value)) { $array[$key]=object_2_array($value, $cur_depth + 1, $depth_limit); } elseif ($cur_depth < $depth_limit && is_array($value)) { $array[$key]=object_2_array($value, $cur_depth + 1, $depth_limit); } else { $array[$key]=$value; } } } return $array; } function phpnum() { // returns the php version number $version = explode('.', phpversion()); return (int) $version[0]; } ?> |
| Sun Jul 13, 2008 8:07 am |
|
|
Joined: Sun Jul 13, 2008 7:58 am Posts: 4 |
Yes i got it.. thanks.. Can u tell me how to add .html at the end of the url
|
| Sun Jul 13, 2008 8:14 am |
|
|
Site Admin Joined: Wed Dec 12, 2007 9:34 pm Posts: 296 |
Hi naveen,
Adding .html to the end of url's is not advised simply because of the amount of edits you would need to make to pligg's codebase and rewrite rules, this could be a lot of extra code and also produce some unwanted errors Adding .html to the end of the URL's produce no advantage, and would make the pligg upgrade process difficult and lengthy affair. The disadvantages outweigh the advantages in my opinion so i would suggest against this particular change Lincoln |
| Sun Jul 13, 2008 12:38 pm |
|
|
|
Page 2 of 2 |
[ 17 posts ] | Go to page Previous 1, 2 |
|
All times are UTC |
Who is online |
Users browsing this forum: No registered users and 0 guests |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum |

