polyfade

polyfade

Joined
May 20, 2011

Activity Stream

polyfade commented on a Page, Dynamic Title and Meta Tags  -  May 20, 2011

I run MAMP, so my site sits in a subdirectory folder. Example: http://mysite.com/myfolder/test.php

test.php, meta_tags.txt, get_meta.php are on the same level.

In the meta_tags.txt file, I could have prepended 'myfolder' in front of all my page files to make this work. Example: myfolder/test.php

However that's counterproductive. Hawkee mentioned "strip the directory from $page"
However, I'm not fluent in PHP, so I didn't know how to do handle precisely. I searched the web for awhile to find a "solution."

Since the fix wasn't illustrated in this post, here is the solution that worked for me:

Comment out, but don't delete since you may need it later:
$page = substr($page, 1);

Add this snippet just below:
$page = ltrim(strrchr($_SERVER['PHP_SELF'], '/'), '/');

Basically, that seems to remove the subdirectory name from the path in order to make adding dynamic meta tags possible.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.