Congratulations to the Winner Linkernel.com of the
Dir.vc Web Directory Competition!
RSS Feed Directory Forums Blog Articles Submit Site Popular Sites Contact Us
Web Directory » Blog
|__ phpLD Hacks & tweeks!

Archive for the ‘phpLD Hacks & tweeks!’ Category

phpLD – Alternative to EMail listings – Using GMail!

Friday, August 24th, 2007

Hi,
Last night I was snooping around the net, trying to find a�Word press Mod for “Email this”, did find one, but didnt appeal me as much! as the one i installed also had a comment box there….. thats inviting spam!

Feeling lazy or rather sleepy, i made the old time mailto: tag, thinking ill see this in the morning! …wallah … clicking on that link it took me to GMail compose page instead of opening my outlook!

Not sure whether its the Google Toolbar or GTalk playing mischeif, but it actually makes things so much easier!

I now have that EMail link on my listings,… and my mail server is not taking the beating! ;)

heres the code for people who wish to use it:

Open link-details.tpl and place this code where you want to:

<a title="EMail: {$linkdetail.TITLE}" href="mailto:?subject={$linkdetail.TITLE}&amp;body={$linkdetail.URL}">EMail this</a>

Enjoy!

Regards,
M.

phpld-Create a 404 error page with phpLD2.1.2

Wednesday, August 22nd, 2007



Hello,
A few days ago IDK.in blog wrote an article about creating 404 error pages in phpLD. Those codes were specifically for phpLD 3.x versions.



Sitting down i wrote a small snippet which would allow phpLD users to create a 404 page with phpLD 2.1.2 also!!!



here goes:



open index.php and find the following code:

$id = get_category();
if (!$tpl->is_cached('main.tpl', $id))
{
	$path = get_path($id);

Replace the whole block by:

$id = get_category();
if($id==0 && strlen(request_uri()) > 2 && request_uri() != '/index.php' && !isset($_REQUEST['q']))
{
	$path[] = array ('ID' => '0',  'TITLE' => _L('404 Page Not Found'), 'TITLE_URL' => '', 'DESCRIPTION' => '');
	$tpl->load_filter('output', 'trimwhitespace');
	echo $tpl->fetch('page404.tpl');
	@ exit(0);
} else if (!$tpl->is_cached('main.tpl', $id)) {
	$path = get_path($id);

2. create a new file called page404.tpl, and save it in the templates directory, with the following code

page404.tpl:

{capture name="title"}{l}404 Page not Found{/l} - {/capture}
{capture assign="in_page_title"}{l}404 Page not Found{/l}{/capture}
{capture assign="description"}{l}404 Page not Found{/l}{/capture}
{include file="header.tpl"}
{include file="top_bar.tpl"}

{strip}
	<h3 class="box_header">{l}{$in_page_title}{/l}</h3>
	<p class="paddcontent">
	<table class="formPage" style="clear: both; margin-top: 3em" align="center" border="0" width="80%">
		<tr>
		<td class="err">
		<h2>{l}Error: 404 Page not Found{/l}</h2>
			{l}The page you were looking for cannot be found.{/l}</td>
		</tr>
	</table>
	{include file="footer.tpl"}
{/strip}

upload this to /templates/ directory,
and upload your index.php file and your done! :)

hope this helps someone

Regards,
M.

Changelog:
24-Aug-07:
1. I got PMs from people having issues on the windows server, so now we use phpLD function “request_uri()”, instead of $_SERVER variable.
2. If someone searches something less than 2 characters in length, it was returning a 404 page, the problem has been fixed above.

phpld-Show full category Path while editing sites

Tuesday, August 14th, 2007

UPDATE: hack upgraded to work with phpLD4.0.0, please download from here

Hi,

i was requested by some to write a small hack similiar to my last about the full path appearing in the approve section;

a similiar thing needed for the editing ;) section also!

So here it goes!

1. This will only work after you apply the full path in approve section mod

2. Will only work for phpLD3.1 and phpLD 3.2

Open /admin/dir_links_edit.php and search for the following code:

   case 'E' : //Edit
      if (empty ($_REQUEST['submit']))
      {
         $data = $db->GetRow("SELECT * FROM `{$tables['link']['name']}` WHERE `ID` = ".$db->qstr($id));
      }

Replace the whole block by :

   case 'E' : //Edit
      if (empty ($_REQUEST['submit']))
      {
         ##$data = $db->GetRow("SELECT * FROM `{$tables['link']['name']}` WHERE `ID` = ".$db->qstr($id));
         $data = getFullLinkInfo($id);
      }

2. Now open /templates/Core/admin/dir_links_edit.tpl and find the code:

<label for="OWNER_EMAIL">{l}Owner Email{/l}:</label>

<input id="OWNER_EMAIL" class="text" maxlength="255" name="OWNER_EMAIL" type="text" value="{$OWNER_EMAIL|escape|trim}" />
            {validate form="dir_links_edit" id="v_OWNER_EMAIL" message=$smarty.capture.invalid_email}

Add after that:

<label for="CACHE_URL">{l}Category Path{/l}:</label>
{$CACHE_URL|escape|trim}

Done!

lemme know how this goes!

Regards,
M.

phpLD – Show Category Path while approving sites

Saturday, August 11th, 2007

UPDATE: the mod has been upgraded to work with phpLd 4.0.0, please down here

Hello,
making my last mod and upgrading it to 3.x, i found loads of times various category names being repeating, most common being “Blog”!

One would find Blog as a root category, and yet you have Art Weblogs under Arts, Blog Hosting under Hosting,….etc

Now in phpLD approve section, all i have is which category is the site submitted to!

I thought it would be better if I were to know the whole path in the admin section so i know exactly where the submission has been made

heres the hack!
Works on phpLD 3.1 and phpLD 3.2,

Open /admin/dirdb_admin.php and find:

function getFullLinkInfo($id=0)

in that function find!

     $sql = "SELECT {$tables['link']['name']}.*, ".$db->IfNull("{$tables['category']['name']}.TITLE", "'Top'")." AS `CATEGORY` FROM `{$tables['link']['name']}` LEFT JOIN `{$tables['category']['name']}` ON ({$tables['link']['name']}.CATEGORY_ID = {$tables['category']['name']}.ID) WHERE {$tables['link']['name']}.ID = ".$db->qstr($id)." LIMIT 1";

Replace this line to :

     $sql = "SELECT {$tables['link']['name']}.*, ".$db->IfNull("{$tables['category']['name']}.TITLE", "'Top'")." AS `CATEGORY`, ".$db->IfNull("{$tables['category']['name']}.CACHE_URL", "'#'")." AS `CACHE_URL` FROM `{$tables['link']['name']}` LEFT JOIN `{$tables['category']['name']}` ON ({$tables['link']['name']}.CATEGORY_ID = {$tables['category']['name']}.ID) WHERE {$tables['link']['name']}.ID = ".$db->qstr($id)." LIMIT 1";

2. Now open up /templates/Core/admin/link_details.tpl and Find:

      <tr class="{cycle values="odd,even"}"><td class="label">{l}Category{/l}:</td><td class="smallDesc">{if $row.CATEGORY_ID eq '-1'}<span class="orphan">{l}Orphan{/l}</span>{else}{$linkInfo.CATEGORY|escape|trim}({$linkInfo.CATEGORY_ID}{/if}</td></tr>

Replace this by:

      <tr class="{cycle values="odd,even"}"><td class="label">{l}Category{/l}:</td><td class="smallDesc">{if $row.CATEGORY_ID eq '-1'}<span class="orphan">{l}Orphan{/l}</span>{else}{$linkInfo.CATEGORY|escape|trim}({$linkInfo.CATEGORY_ID})<br />[{$linkInfo.CACHE_URL|escape|trim}]{/if}</td></tr>

Older builds of the 3.2 version, or 3.1 may have a different line for this, all that has been added to the category line is:

<br />[{$linkInfo.CACHE_URL|escape|trim}]

Done!

Here’s a Screenshot :

phpLD - Show Category Path while approving sites

Hope this helps someone!
Regards,
M.

phpLD – How to highlight featured links!

Sunday, July 15th, 2007

To highlight featured links in your top pages use the following code,

1. Open /templates/link.tpl, and find the following code:

<table><tr>

change it to:

<table width="100%"><tr {if $link.FEATURED} class="feature_list"{/if}>

2. Open /main.css add the following to the end of the file:

tr.feature_list, td.feature_list{background-color:#dcdcdc; padding:5px;}

Done!

hope that helps someone!
M.

phpLD – Listing featured links above normal links in your top pages!

Saturday, July 14th, 2007

phpLD – This mod will list Featured Links above other links in New Listings, Popular Listings, and Top Rated Listings.
(http://phplinkdirectory.com/forum/showthread.php?t=1536)

I found this intersting mod listed here, wrks gr8 for one. just made a quick hack to seperate the two!

Open index.php, and change:
Code:

case 'd':
	$links = $db->GetAll("SELECT * FROM {$tables['link']['name']} WHERE STATUS=2 $expire_where ORDER BY DATE_ADDED desc limit 0, ".LINKS_TOP);
	$path[] = array ('ID' =&gt; '0', 'TITLE' =&gt; _L('New Listings'), 'TITLE_URL' =&gt; '', 'DESCRIPTION' =&gt; '');
	break;
case 'h':
	$links = $db->GetAll("SELECT * FROM {$tables['link']['name']} WHERE STATUS=2 $expire_where ORDER BY hits desc limit 0, ".LINKS_TOP);
	$path[] = array ('ID' =&gt; '0', 'TITLE' => _L('Popular Listings'), 'TITLE_URL' => '', 'DESCRIPTION' => '');
	break;

To:


case 'd':
	if (FTR_ENABLE) {
		$feat_links = $db->GetAll("SELECT * FROM {$tables['link']['name']} WHERE STATUS=2 AND FEATURED=1 $expire_where ORDER BY DATE_ADDED desc limit 0, ".LINKS_TOP);
		$tpl->assign('feat_links', $feat_links);

		$links = $db->GetAll("SELECT * FROM {$tables['link']['name']} WHERE STATUS=2 AND FEATURED=0 $expire_where ORDER BY DATE_ADDED desc limit 0, ".LINKS_TOP);

	} else {

		$links = $db-&gt;GetAll("SELECT * FROM {$tables['link']['name']} WHERE STATUS=2 $expire_where ORDER BY DATE_ADDED desc limit 0, ".LINKS_TOP);
	}
	$path[] = array ('ID' =&gt; '0', 'TITLE' =&gt; _L('Top ' . LINKS_TOP . ' New Listings'), 'TITLE_URL' =&gt; '', 'DESCRIPTION' =&gt; '');
	break;

case 'h':
default :
	if (FTR_ENABLE) {
		$feat_links = $db-&gt;GetAll("SELECT * FROM {$tables['link']['name']} WHERE STATUS=2 AND FEATURED=1 $expire_where ORDER BY hits desc limit 0, ".LINKS_TOP);
		$tpl-&gt;assign('feat_links', $feat_links);

		$links = $db-&gt;GetAll("SELECT * FROM {$tables['link']['name']} WHERE STATUS=2 AND FEATURED=0 $expire_where ORDER BY hits desc limit 0, ".LINKS_TOP);
	} else {
		$links = $db-&gt;GetAll("SELECT * FROM {$tables['link']['name']} WHERE STATUS=2 $expire_where ORDER BY DATE_ADDED desc limit 0, ".LINKS_TOP);
	}
	$path[] = array ('ID' => '0', 'TITLE' => _L('Top ' . LINKS_TOP . ' Popular Listings'), 'TITLE_URL' => '', 'DESCRIPTION' => '');
	break;

Hope this helps someone!

M.



Entries (RSS) and Comments (RSS) Blog – Dir.vc :: Web Directory is proudly powered by WordPress - Site By : M-Solutions India