<? DEW-CODE.COM  

Downloads

Assorted scripts  (1)
DewNewPHPLinks  (9)





Lost Password?
No account yet? Register

Dew-Code Newsfeed

Resources


 USdigitalcable.com

Dew-Code
Welcome, Guest
Please Login or Register.    Lost Password?
Re:SEO friendly (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Re:SEO friendly
#242
D_Jay (User)
Fresh Boarder
Posts: 17
graphgraph
User Offline Click here to see the profile of this user
Re:SEO friendly 3 Years, 8 Months ago Karma: 0  
I gave this a try on a newly installed version of PhpLinks but didn't get anywhere. You can see the result at www.perthbusiness.info, where links to the category pages just lead to empty pages. I think my problem was not knowing precisely where to install the code on the functions and directory files. With the directory file, I fear that I pasted over some important code that needed to stay in.
 
Report to moderator   Logged Logged  
 
Last Edit: 2008/05/30 13:23 By D_Jay.
  The administrator has disabled public write access.
#243
jnasta (User)
Senior Boarder
Posts: 70
graphgraph
User Offline Click here to see the profile of this user
Gender: Male John Nasta Photography Location: Brooklyn, NY
Re:SEO friendly 3 Years, 8 Months ago Karma: 1  
Do you have a backup of the directory file before the changes? If not, one of us (including me) can probably get an untouched one to you. If you've done any other changes they'll be undone but at least your site will work.

I will try to test this code again next week and post my results. When I tried it last time the public side of my site was fine but I couldn't get into my admin due to some error in functions.php.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#246
D_Jay (User)
Fresh Boarder
Posts: 17
graphgraph
User Offline Click here to see the profile of this user
Re:SEO friendly 3 Years, 8 Months ago Karma: 0  
That's okay, it's just a site I set up to test the code. I will do a fresh install and wait to see how your results go. Good luck.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#256
Dewed (Admin)
Admin
Posts: 603
graph
User Online Now Click here to see the profile of this user
Dew-Code.com
Re:SEO friendly 3 Years, 8 Months ago Karma: 9  
I added the 2 new functions to inlcude/functions.php pretty mutch just as Fattymatty posted them, here they are again for convenience ... I just pasted them under the comments at the top of functions.php

Code:

///SEO goods - ADDED FOR TITLE AND KEYWORDS CUSTOMIZATION ///submitted by users of the pre-2008 dew-code.com forum function get_cat($PID){ global $tb_categories; $gc_query = sql_query(" select $tb_categories.Category as cat_name from $tb_categories where ID=$PID"); while($gc_array = sql_fetch_array($gc_query)){ $cat = $gc_array[cat_name]; } return $cat; } function get_ParentCats($PID){ global $tb_categories; $gcid = $PID; while($gcid > 0){ $query_str = "select $tb_categories.Category, $tb_categories.ID, $tb_categories.PID from $tb_categories where $tb_categories.ID = $gcid"; $mlc_query = sql_query($query_str); $mlc_array = sql_fetch_array($mlc_query); $cat_array[] = $mlc_array["Category"]; $pid_array[] = $mlc_array["ID"]; $gcid = $mlc_array["PID"]; } $count = sizeof($pid_array); for($depth=$count;$depth>=0;$depth--){ if($pid_array[$depth]){ if($PID == $pid_array[$depth]){ $htmlsrc .= ereg_replace("_"," ",($cat_array[$depth])); $htmlsrc .= ""; } else { $htmlsrc .= ereg_replace("_"," ",($cat_array[$depth])); $htmlsrc .= ", "; } } } return $htmlsrc; } //END ADDED FOR TITLE AND KEYWORD CUSTOMIZATION
Then editing the directory file, I did things abit differently. Basically the get_ParentCats function could be very CPU intensive on a deeply nested category, so I wanted to be sure I only call the function once per page view. With the output assigned to a variable, I can just print the variable when and where I want it. Around line #76, under
Code:

} else {$PID ="";}
I added the function calls to fetch the entire category trail only if the $PID was greater than 3, since the install I'm working on only has 3 top level categories... Change the "3" to the number of top level categories you have, this just ensures you dont call the more expensive get_ParentCats function unneccesarily.
Code:

if ($PID > 3){ $keywords = get_ParentCats($PID); } else { $keywords = get_cat($PID); }
Then I just print the $keyword variable within in the keyword, description and title tags
Code:

<meta name = "keywords" content = " blah blah blah <?php echo $keywords;?> <meta name = "description" content = "<?php echo $gl[SiteTitle] .'blah'.$keywords; ?> . . . . . . . . . <title> <? echo "$gl[SiteTitle]"; echo ' '. $keywords; ?>
Now I just need to write a great site all about blah !
 
Report to moderator   Logged Logged  
 
Last Edit: 2008/06/01 12:09 By Dewed.
 
Nothing to it but to Dew it !
Dew-Code.com
  The administrator has disabled public write access.
#265
D_Jay (User)
Fresh Boarder
Posts: 17
graphgraph
User Offline Click here to see the profile of this user
Re:SEO friendly 3 Years, 8 Months ago Karma: 0  
My directory page is coming up with "Parse error: syntax error, unexpected T_STRING, expecting ',' or ';'." Looks to be a problem with the meta tag code.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#268
Dewed (Admin)
Admin
Posts: 603
graph
User Online Now Click here to see the profile of this user
Dew-Code.com
Re:SEO friendly 3 Years, 8 Months ago Karma: 9  
Please post the complete error..

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';'." in what file ? What line number ?

DOH! ok, I think I missed a semi-colon in my example.. also, short PHP open tags may not be enabled on your server, so a slight change.

Code:

<meta name = "keywords" content = " blah blah blah <?php echo $keywords;?> <meta name = "description" content = "<?php echo $gl[SiteTitle] .'blah'.$keywords; ?> . . . . . . . . . <title> <? echo "$gl[SiteTitle]"; echo ' '. $keywords; ?>
I edited the above post as well, just to avoid confusion. If that doesn't help, please post the complete error.
 
Report to moderator   Logged Logged  
 
Last Edit: 2008/06/01 12:10 By Dewed.
 
Nothing to it but to Dew it !
Dew-Code.com
  The administrator has disabled public write access.
Go to top Post Reply
get the latest posts directly to your desktop
Outsource your projects to thousands of programmers at
ScriptLance.com
Newsflash
Interested in
advertising?

This space for rent!

Sign up for PayPal and start accepting credit card payments instantly.
Copyright Dew-Code 2008