<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>mod for shorter url and title</title>
        <description> This is a complete version of shorter url and title with options on the admin.php file and with &amp;quot;smart&amp;quot; shorter title (I hope) as it will show complete words instead of cutting them and showing only part of them.

Here we go:

file: admin/configset.php
near line 36

add these if statements

if ($_max_len_title==&amp;quot;&amp;quot;) {
	$_max_len_title=40;
}

if ($_start_char_title==&amp;quot;&amp;quot;) {
	$_start_char_title=18;
}

if ($_end_char_title==&amp;quot;&amp;quot;) {
	$_end_char_title=7;
}

if ($_max_len_url==&amp;quot;&amp;quot;) {
	$_max_len_url=35;
}

if ($_start_char_url==&amp;quot;&amp;quot;) {
	$_start_char_url=18;
}

if ($_end_char_url==&amp;quot;&amp;quot;) {
	$_end_char_url=10;
}

Near line 220:

/**
 * Limit number of characters to show on title and url
 */
fwrite($fhandle, &amp;quot;\n\n// Max length of title to show on result the page.\n&amp;quot;);
fwrite($fhandle,&amp;quot;$&amp;quot;.&amp;quot;max_len_title = &amp;quot;.$_max_len_title. &amp;quot;;&amp;quot;);
fwrite($fhandle, &amp;quot;\n\n// Max length of url to show on result the page.\n&amp;quot;);
fwrite($fhandle,&amp;quot;$&amp;quot;.&amp;quot;max_len_url = &amp;quot;.$_max_len_url. &amp;quot;;&amp;quot;);
/**
 * Show x characters at beginning and at the end
 */
fwrite($fhandle, &amp;quot;\n\n// Number of characters to show at beginning of title.\n&amp;quot;);
fwrite($fhandle,&amp;quot;$&amp;quot;.&amp;quot;start_char_title = &amp;quot;.$_start_char_title. &amp;quot;;&amp;quot;);
fwrite($fhandle, &amp;quot;\n\n// Number of characters to show at end of title.\n&amp;quot;);
fwrite($fhandle,&amp;quot;$&amp;quot;.&amp;quot;end_char_title = &amp;quot;.$_end_char_title. &amp;quot;;&amp;quot;);
fwrite($fhandle, &amp;quot;\n\n// Number of characters to show at beginning of url.\n&amp;quot;);
fwrite($fhandle,&amp;quot;$&amp;quot;.&amp;quot;start_char_url = &amp;quot;.$_start_char_url. &amp;quot;;&amp;quot;);
fwrite($fhandle, &amp;quot;\n\n// Number of characters to show at end of url.\n&amp;quot;);
fwrite($fhandle,&amp;quot;$&amp;quot;.&amp;quot;end_char_url = &amp;quot;.$_end_char_url. &amp;quot;;&amp;quot;);

Near line 591:


&amp;lt;!-- Max length of title on result page - added by Diego --&amp;gt;
&amp;lt;tr&amp;gt;
&amp;lt;td class=&amp;quot;left1&amp;quot;&amp;gt;&amp;lt;input name=&amp;quot;_max_len_title&amp;quot; type=&amp;quot;text&amp;quot; value=
&amp;quot;&amp;lt;?php print $max_len_title;?&amp;gt;&amp;quot; id=&amp;quot;max_len_title&amp;quot; size=&amp;quot;5&amp;quot; maxlength=&amp;quot;2&amp;quot;&amp;gt; &amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;Max length of title to show on result the page.&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;

&amp;lt;!-- Number of characters to show at beginning of title on result page - added by Diego --&amp;gt;
&amp;lt;tr&amp;gt;
&amp;lt;td class=&amp;quot;left1&amp;quot;&amp;gt;&amp;lt;input name=&amp;quot;_start_char_title&amp;quot; type=&amp;quot;text&amp;quot; value=
&amp;quot;&amp;lt;?php print $start_char_title;?&amp;gt;&amp;quot; id=&amp;quot;start_char_title&amp;quot; size=&amp;quot;5&amp;quot; maxlength=&amp;quot;2&amp;quot;&amp;gt; &amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;Number of characters to show at beginning of title on result page.&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;

&amp;lt;!-- Number of characters to show at end of title on result page - added by Diego --&amp;gt;
&amp;lt;tr&amp;gt;
&amp;lt;td class=&amp;quot;left1&amp;quot;&amp;gt;&amp;lt;input name=&amp;quot;_end_char_title&amp;quot; type=&amp;quot;text&amp;quot; value=
&amp;quot;&amp;lt;?php print $end_char_title;?&amp;gt;&amp;quot; id=&amp;quot;end_char_title&amp;quot; size=&amp;quot;5&amp;quot; maxlength=&amp;quot;2&amp;quot;&amp;gt; &amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;Number of characters to show at end of title on result page.&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;

&amp;lt;!-- Max length of url on result page - added by Diego --&amp;gt;
&amp;lt;tr&amp;gt;
&amp;lt;td class=&amp;quot;left1&amp;quot;&amp;gt;&amp;lt;input name=&amp;quot;_max_len_url&amp;quot; type=&amp;quot;text&amp;quot; value=
&amp;quot;&amp;lt;?php print $max_len_url;?&amp;gt;&amp;quot; id=&amp;quot;max_len_url&amp;quot; size=&amp;quot;5&amp;quot; maxlength=&amp;quot;2&amp;quot;&amp;gt; &amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;Max length of url to show on result the page.&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;

&amp;lt;!-- Number of characters to show at beginning of url on result page - added by Diego --&amp;gt;
&amp;lt;tr&amp;gt;
&amp;lt;td class=&amp;quot;left1&amp;quot;&amp;gt;&amp;lt;input name=&amp;quot;_start_char_url&amp;quot; type=&amp;quot;text&amp;quot; value=
&amp;quot;&amp;lt;?php print $start_char_url;?&amp;gt;&amp;quot; id=&amp;quot;start_char_url&amp;quot; size=&amp;quot;5&amp;quot; maxlength=&amp;quot;2&amp;quot;&amp;gt; &amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;Number of characters to show at beginning of title on result page.&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;

&amp;lt;!-- Number of characters to show at end of url on result page - added by Diego --&amp;gt;
&amp;lt;tr&amp;gt;
&amp;lt;td class=&amp;quot;left1&amp;quot;&amp;gt;&amp;lt;input name=&amp;quot;_end_char_url&amp;quot; type=&amp;quot;text&amp;quot; value=
&amp;quot;&amp;lt;?php print $end_char_url;?&amp;gt;&amp;quot; id=&amp;quot;end_char_url&amp;quot; size=&amp;quot;5&amp;quot; maxlength=&amp;quot;2&amp;quot;&amp;gt; &amp;lt;/td&amp;gt;
&amp;lt;td&amp;gt;Number of characters to show at end of url on result page.&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;


File include/searchfuncs.php
Near line 597
Merge your code so that it look like this:

			if ($title=='')
				$title = $sph_messages[&amp;quot;Untitled&amp;quot;];
			/**
			 * Show shorter title - added by Diego
			 */
			while( substr( $title, -$end_char_title, 1) !=' '  &amp;amp;&amp;amp;  $end_char_title &amp;lt; strlen($title) - $start_char_title - 3 ){
				$end_char_title++;
			}
			while( substr( $title, $start_char_title, 1) !=' '  &amp;amp;&amp;amp;  $start_char_title &amp;lt; strlen($title) - $end_char_title - 3 ){
				$start_char_title++;
			}
            $title = strlen($title) &amp;gt; $max_len_title ? substr($title, 0, $start_char_title).&amp;quot;...&amp;quot;.substr($title, -$end_char_title):$title;

Near line 618
Merge your code so that it looks like:

				$url2 = $url;
				/**
				 * Show shorter url - added by Diego
				 */
				if (strlen($url2) &amp;gt; $max_len_url) {
					$url2 = substr($url2, 0, $start_char_url).&amp;quot;...&amp;quot;.substr($url2, -$end_char_url) ;
				}

and comment out  lines near 629

/*
			if (strlen($title) &amp;gt; 80) {
				$title = substr($title, 0,75).&amp;quot;...&amp;quot;;
			}
*/
That all.
Now you can go into the admin.php file, then into the &amp;quot;Settings&amp;quot; and play around with the values.

If you find any problems, let me know and I hope this helps people using sphider.</description>
        <link>http://www.sphider.eu/forum/read.php?3,2151,2151#msg-2151</link>
        <lastBuildDate>Tue, 18 Jun 2013 09:25:25 +0300</lastBuildDate>
        <generator>Phorum 5.2.10</generator>
        <item>
            <guid>http://www.sphider.eu/forum/read.php?3,2151,2239#msg-2239</guid>
            <title>Re: mod for shorter url and title</title>
            <link>http://www.sphider.eu/forum/read.php?3,2151,2239#msg-2239</link>
            <description><![CDATA[ Hi,<br />
<br />
There are two options as to why it is not working.<br />
<br />
1- the permissions on the settings/conf.php file<br />
<br />
2- Which I found on my site so  it may be what you see on your site as well<br />
<br />
My mod does not &quot;cut&quot; words when it makes the title shorter, for example:<br />
<br />
if you set the title <br />
max length as 40 characters,<br />
number of character at the beginning as 2<br />
number of character at the end as 2<br />
<br />
it will show same results as if you set<br />
<br />
<br />
max length as 40 characters,<br />
number of character at the beginning as 4<br />
number of character at the end as 4<br />
<br />
as long as the title is like this (example)<br />
Title:<br />
<br />
Contact us on my website.<br />
<br />
because internally, my mod would do<br />
<br />
max length as 40 characters,<br />
number of character at the beginning as 7<br />
number of character at the end as 8<br />
<br />
(It modifies your numbers until it finds a space.)<br />
<br />
<br />
Let me know if this may be the problem.<br />
<br />
Diego]]></description>
            <dc:creator>fmpwizard</dc:creator>
            <category>Sphider Mods</category>
            <pubDate>Sat, 27 Oct 2007 06:42:13 +0300</pubDate>
        </item>
        <item>
            <guid>http://www.sphider.eu/forum/read.php?3,2151,2237#msg-2237</guid>
            <title>Re: mod for shorter url and title</title>
            <link>http://www.sphider.eu/forum/read.php?3,2151,2237#msg-2237</link>
            <description><![CDATA[ It's a good mod. however it doesn't work for me....<br />
<br />
It works how it is by default. <br />
<br />
When I change the values in the admin panel nothing really changes.<br />
<br />
Can you simply provide searchfuncs.php and configset.php files for 1.3.3. ?<br />
<br />
Thanks in advance!]]></description>
            <dc:creator>slashpix</dc:creator>
            <category>Sphider Mods</category>
            <pubDate>Sat, 27 Oct 2007 05:17:41 +0300</pubDate>
        </item>
        <item>
            <guid>http://www.sphider.eu/forum/read.php?3,2151,2151#msg-2151</guid>
            <title>mod for shorter url and title</title>
            <link>http://www.sphider.eu/forum/read.php?3,2151,2151#msg-2151</link>
            <description><![CDATA[ This is a complete version of shorter url and title with options on the admin.php file and with &quot;smart&quot; shorter title (I hope) as it will show complete words instead of cutting them and showing only part of them.<br />
<br />
Here we go:<br />
<br />
file: admin/configset.php<br />
near line 36<br />
<br />
add these if statements<br />
<pre class="bbcode">
if ($_max_len_title==&quot;&quot;) {
	$_max_len_title=40;
}

if ($_start_char_title==&quot;&quot;) {
	$_start_char_title=18;
}

if ($_end_char_title==&quot;&quot;) {
	$_end_char_title=7;
}

if ($_max_len_url==&quot;&quot;) {
	$_max_len_url=35;
}

if ($_start_char_url==&quot;&quot;) {
	$_start_char_url=18;
}

if ($_end_char_url==&quot;&quot;) {
	$_end_char_url=10;
}</pre>
<br />
Near line 220:<br />
<pre class="bbcode">
/**
 * Limit number of characters to show on title and url
 */
fwrite($fhandle, &quot;\n\n// Max length of title to show on result the page.\n&quot;);
fwrite($fhandle,&quot;$&quot;.&quot;max_len_title = &quot;.$_max_len_title. &quot;;&quot;);
fwrite($fhandle, &quot;\n\n// Max length of url to show on result the page.\n&quot;);
fwrite($fhandle,&quot;$&quot;.&quot;max_len_url = &quot;.$_max_len_url. &quot;;&quot;);
/**
 * Show x characters at beginning and at the end
 */
fwrite($fhandle, &quot;\n\n// Number of characters to show at beginning of title.\n&quot;);
fwrite($fhandle,&quot;$&quot;.&quot;start_char_title = &quot;.$_start_char_title. &quot;;&quot;);
fwrite($fhandle, &quot;\n\n// Number of characters to show at end of title.\n&quot;);
fwrite($fhandle,&quot;$&quot;.&quot;end_char_title = &quot;.$_end_char_title. &quot;;&quot;);
fwrite($fhandle, &quot;\n\n// Number of characters to show at beginning of url.\n&quot;);
fwrite($fhandle,&quot;$&quot;.&quot;start_char_url = &quot;.$_start_char_url. &quot;;&quot;);
fwrite($fhandle, &quot;\n\n// Number of characters to show at end of url.\n&quot;);
fwrite($fhandle,&quot;$&quot;.&quot;end_char_url = &quot;.$_end_char_url. &quot;;&quot;);</pre>
<br />
Near line 591:<br />
<pre class="bbcode">

&lt;!-- Max length of title on result page - added by Diego --&gt;
&lt;tr&gt;
&lt;td class=&quot;left1&quot;&gt;&lt;input name=&quot;_max_len_title&quot; type=&quot;text&quot; value=
&quot;&lt;?php print $max_len_title;?&gt;&quot; id=&quot;max_len_title&quot; size=&quot;5&quot; maxlength=&quot;2&quot;&gt; &lt;/td&gt;
&lt;td&gt;Max length of title to show on result the page.&lt;/td&gt;
&lt;/tr&gt;

&lt;!-- Number of characters to show at beginning of title on result page - added by Diego --&gt;
&lt;tr&gt;
&lt;td class=&quot;left1&quot;&gt;&lt;input name=&quot;_start_char_title&quot; type=&quot;text&quot; value=
&quot;&lt;?php print $start_char_title;?&gt;&quot; id=&quot;start_char_title&quot; size=&quot;5&quot; maxlength=&quot;2&quot;&gt; &lt;/td&gt;
&lt;td&gt;Number of characters to show at beginning of title on result page.&lt;/td&gt;
&lt;/tr&gt;

&lt;!-- Number of characters to show at end of title on result page - added by Diego --&gt;
&lt;tr&gt;
&lt;td class=&quot;left1&quot;&gt;&lt;input name=&quot;_end_char_title&quot; type=&quot;text&quot; value=
&quot;&lt;?php print $end_char_title;?&gt;&quot; id=&quot;end_char_title&quot; size=&quot;5&quot; maxlength=&quot;2&quot;&gt; &lt;/td&gt;
&lt;td&gt;Number of characters to show at end of title on result page.&lt;/td&gt;
&lt;/tr&gt;

&lt;!-- Max length of url on result page - added by Diego --&gt;
&lt;tr&gt;
&lt;td class=&quot;left1&quot;&gt;&lt;input name=&quot;_max_len_url&quot; type=&quot;text&quot; value=
&quot;&lt;?php print $max_len_url;?&gt;&quot; id=&quot;max_len_url&quot; size=&quot;5&quot; maxlength=&quot;2&quot;&gt; &lt;/td&gt;
&lt;td&gt;Max length of url to show on result the page.&lt;/td&gt;
&lt;/tr&gt;

&lt;!-- Number of characters to show at beginning of url on result page - added by Diego --&gt;
&lt;tr&gt;
&lt;td class=&quot;left1&quot;&gt;&lt;input name=&quot;_start_char_url&quot; type=&quot;text&quot; value=
&quot;&lt;?php print $start_char_url;?&gt;&quot; id=&quot;start_char_url&quot; size=&quot;5&quot; maxlength=&quot;2&quot;&gt; &lt;/td&gt;
&lt;td&gt;Number of characters to show at beginning of title on result page.&lt;/td&gt;
&lt;/tr&gt;

&lt;!-- Number of characters to show at end of url on result page - added by Diego --&gt;
&lt;tr&gt;
&lt;td class=&quot;left1&quot;&gt;&lt;input name=&quot;_end_char_url&quot; type=&quot;text&quot; value=
&quot;&lt;?php print $end_char_url;?&gt;&quot; id=&quot;end_char_url&quot; size=&quot;5&quot; maxlength=&quot;2&quot;&gt; &lt;/td&gt;
&lt;td&gt;Number of characters to show at end of url on result page.&lt;/td&gt;
&lt;/tr&gt;</pre>
<br />
<br />
File include/searchfuncs.php<br />
Near line 597<br />
Merge your code so that it look like this:<br />
<pre class="bbcode">
			if ($title=='')
				$title = $sph_messages[&quot;Untitled&quot;];
			/**
			 * Show shorter title - added by Diego
			 */
			while( substr( $title, -$end_char_title, 1) !=' '  &amp;&amp;  $end_char_title &lt; strlen($title) - $start_char_title - 3 ){
				$end_char_title++;
			}
			while( substr( $title, $start_char_title, 1) !=' '  &amp;&amp;  $start_char_title &lt; strlen($title) - $end_char_title - 3 ){
				$start_char_title++;
			}
            $title = strlen($title) &gt; $max_len_title ? substr($title, 0, $start_char_title).&quot;...&quot;.substr($title, -$end_char_title):$title;</pre>
<br />
Near line 618<br />
Merge your code so that it looks like:<br />
<pre class="bbcode">
				$url2 = $url;
				/**
				 * Show shorter url - added by Diego
				 */
				if (strlen($url2) &gt; $max_len_url) {
					$url2 = substr($url2, 0, $start_char_url).&quot;...&quot;.substr($url2, -$end_char_url) ;
				}</pre>
<br />
and comment out  lines near 629<br />
<pre class="bbcode">
/*
			if (strlen($title) &gt; 80) {
				$title = substr($title, 0,75).&quot;...&quot;;
			}
*/</pre>
That all.<br />
Now you can go into the admin.php file, then into the &quot;Settings&quot; and play around with the values.<br />
<br />
If you find any problems, let me know and I hope this helps people using sphider.]]></description>
            <dc:creator>fmpwizard</dc:creator>
            <category>Sphider Mods</category>
            <pubDate>Mon, 22 Oct 2007 08:19:57 +0300</pubDate>
        </item>
    </channel>
</rss>
