Status
Not open for further replies.

anantgupta

Active Member
677
2009
7
0
Hello,
I am trying to fix this mod so that it is compatible with smf 1.1.12
http://custom.simplemachines.org/mods/index.php?mod=1138

I am weak in database.
i searched and found that $smcFunc doesnt work with smf 1.1.12

Can you rewrite this function so that it works with smf 1.1.12 also ??

Code:
function MetaTagsGenerateTeaser ($id_msg)
{
	global $smcFunc;

	$request = $smcFunc['db_query']('', '
		SELECT body
		FROM {db_prefix}messages
		WHERE id_msg = {int:id_msg}',
		array(
			'id_msg' => $id_msg
		));

	list ($teaser) = $smcFunc['db_fetch_row']($request);
	$smcFunc['db_free_result']($request);
 
6 comments
Thought of editing the last reply but decided to make another reply <3
Next try...
Code:
function MetaTagsGenerateTeaser ($id_msg)
{
	
	$request = db_query("SELECT body
		FROM (smf_messages AS m)
		WHERE m.id_msg = 1");

	list ($teaser) = mysql_fetch_row($request);
	mysql_free_result($request);

	// Format as a plain text string.
	$teaser = MetaTagsSpecialChars(str_replace('<br />', ' ', parse_bbc($teaser)));

	// Less than the teasear limit, just return.
	if(strlen($teaser) < 150)
		return $teaser;

	// Otherwise grab the teaser.
	$teaser = substr($teaser, 0, 150);
	return substr($teaser, 0, strrpos($teaser, ' '));
}

just need array to search for the current post's id_msg and place it here in place of 1.
How to do it ?
People on smf support also not replying damn... :(
m.id_msg = 1
 
Status
Not open for further replies.
Back
Top