PhpDig.net

PhpDig.net (http://www.phpdig.net/forum/index.php)
-   How-to Forum (http://www.phpdig.net/forum/forumdisplay.php?f=33)
-   -   Problem whith inclute in template SSI blocks (http://www.phpdig.net/forum/showthread.php?t=339)

SavageNoName 12-29-2003 01:51 PM

Problem whith inclute in template SSI blocks
 
Hi
Sorry my english.
I have truble with include in template SSI-blocks.
Link http://www.windowsfaq.ru/search/
What not work SSI?

Charter 12-29-2003 05:18 PM

Hi. The search page is PHP, not SHTML, so SSI is not working. To get your includes into the template do the following.

First add the following function to the top of the search_function.php file:
PHP Code:

function get_my_includes($filename) {
  if (
file_exists($filename)) {
    
$buffer "";
    
$handle fopen($filename"r");
    while (!
feof($handle)) {
      
$buffer .= fgets($handle4096);
    }
    
fclose($handle);
    return 
$buffer;
  }


Next in search_function.php replace:
PHP Code:

if ($template == 'array' || is_file($template)) {
    
$phpdig_version PHPDIG_VERSION;
    
$t_mstrings compact('powered_by_link','title_message','phpdig_version','result_message','nav_bar','ignore_message','ignore_commess','pages_bar','previous_link','next_link','templates_links');
    
$t_fstrings phpdigMakeForm($query_string,$option,$limite,SEARCH_PAGE,$site,$path,'template',$template);
    if (
$template == 'array') {
        return 
array_merge($t_mstrings,$t_fstrings,array('results'=>$table_results));
    }
    else {
        
$t_strings array_merge($t_mstrings,$t_fstrings);
        
phpdigParseTemplate($template,$t_strings,$table_results);
    }


with the following:
PHP Code:

// check that the paths are correct or use full paths
$my_page_header get_my_includes("../../incl/header.html");
$my_page_metaword get_my_includes("../../incl/metaword.html");
$my_page_top get_my_includes("../../incl/top.html");
$my_page_menu get_my_includes("../../incl/menu.html");
$my_page_bottom get_my_includes("../../incl/bottom.html");

if (
$template == 'array' || is_file($template)) {
    
$phpdig_version PHPDIG_VERSION;
    
$t_mstrings compact('my_page_header','my_page_metaword','my_page_top','my_page_menu','my_page_bottom','powered_by_link','title_message','phpdig_version','result_message','nav_bar','ignore_message','ignore_commess','pages_bar','previous_link','next_link','templates_links');
    
$t_fstrings phpdigMakeForm($query_string,$option,$limite,SEARCH_PAGE,$site,$path,'template',$template);
    if (
$template == 'array') {
        return 
array_merge($t_mstrings,$t_fstrings,array('results'=>$table_results));
    }
    else {
        
$t_strings array_merge($t_mstrings,$t_fstrings);
        
phpdigParseTemplate($template,$t_strings,$table_results);
    }


Finally in the template replace:
Code:

<!--#include virtual="../../incl/header.html" -->
<!--#include virtual="../../incl/metaword.html" -->
<!--#include virtual="../../incl/top.html" -->
<!--#include virtual="../../incl/menu.html" -->
<!--#include virtual="../../incl/bottom.html" -->

with the following:
Code:

<phpdig:my_page_header/>
<phpdig:my_page_metaword/>
<phpdig:my_page_top/>
<phpdig:my_page_menu/>
<phpdig:my_page_bottom/>

Remember to remove any "word" wrapping in the above code.

Also, you are using Cyrillic. Did you do as shown in this thread, or how did you add Cyrillic support?

SavageNoName 12-30-2003 03:53 AM

Great Tnx
http://www.windowsfaq.ru/smiles/bounce.gif
http://www.windowsfaq.ru/search/

[code]
$phpdig_language = "ru";

define('PHPDIG_ENCODING','windows-1251');

$phpdig_string_subst['windows-1251'] = 'A:ÀÁÂÃÄÅ,a:*áâãäå,O:ÒÓÔÕÖØ,o:òóôõöø,E:ÈÉÊË,e: éêë,C:Ç,c:ç,I:ÌÍÎÏ,i:ì*îï,U:ÙÚÛÜ,u:ùúûü,Y:Ý,y:ÿý,N :Ñ,n:ñ';

$phpdig_words_chars['windows-1251'] = '[:alnum:]ðþß';

Charter 12-30-2003 04:00 AM

Hi. Does $phpdig_string_subst get all of these from C0 to FF?
Code:

Windows-1251 Characters (note A0 is a space):

A0-AF _ Ў ў Ј ¤ Ґ ¦ § Ё © Є « ¬ _ ® Ї
B0-BF ° ± І і ґ µ ¶ · ё № є » ј Ѕ ѕ ї
C0-CF А Б В Г Д Е Ж З И Й К Л М Н О П
D0-DF Р С Т У Ф Х Ц Ч Ш Щ Ъ Ы Ь Э Ю Я
E0-EF а б в г д е ж з и й к л м н о п
F0-FF р с т у ф х ц ч ш щ ъ ы ь э ю я

Characters in extended ASCII (note A0 is a space):

A0-AF _ ¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ _ ® ¯
B0-BF ° ± ² ³ ´ µ ¶ · ¸ ¹ º » ¼ ½ ¾ ¿
C0-CF À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï
D0-DF Ð Ñ Ò Ó Ô Õ Ö × Ø Ù Ú Û Ü Ý Þ ß
E0-EF * á â ã ä å æ ç è é ê ë ì * î ï
F0-FF ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý þ ÿ


Charter 12-30-2003 04:17 AM

Hi. A search for избежать gives no results. Try doing the following instead.

In the config.php file set the following:
PHP Code:

define('PHPDIG_ENCODING','windows-1251');

// give functions something trivial to do
$phpdig_string_subst['windows-1251'] = 'Q:Q,q:q';

// remove word wrapping in the below line
$phpdig_words_chars['windows-1251'] = '[:alnum:]ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞß*áâãäåæçèéêëì*îïðñòóôõö÷øùúûüýþÿ'

In addition, in the robot_functions.php file is a phpdigIndexFile function.

In the phpdigIndexFile function replace:
PHP Code:

global $common_words,$relative_script_path,$s_yes,$s_no,$br

with the following:
PHP Code:

global $phpdig_words_chars,$common_words,$relative_script_path,$s_yes,$s_no,$br

Also, in the phpdigIndexFile function replace:
PHP Code:

        if (strlen($key) > SMALL_WORDS_SIZE and strlen($key) <= MAX_WORDS_SIZE and !isset($common_words[$key]) and ereg('^[0-9a-zßðþ]',$key)) 

with the following:
PHP Code:

        if (strlen($key) > SMALL_WORDS_SIZE and strlen($key) <= MAX_WORDS_SIZE and !isset($common_words[$key]) and ereg('^['.$phpdig_words_chars[PHPDIG_ENCODING].']',$key)) 

Remember to remove any "word" wrapping in the above code and use PhpDig 1.6.5 if not used already.

Also, you will need to reindex for the changes to take effect.

SavageNoName 12-30-2003 05:14 AM

Respect, all ok. Search èçáåæ*òü - 2 result.

Small bug.
From admin panel press Delete site. All table empty, except keywords. Why?

Charter 12-30-2003 05:23 AM

Hi. Click the Clean Dictionary link, or empty the table from phpMyAdmin or shell. The latter may be faster.

Charter 12-30-2003 07:00 AM

Hi. Now I search for избежать and get two results. Did you use the following code and make the other changes?
PHP Code:

define('PHPDIG_ENCODING','windows-1251'); 

// give functions something trivial to do 
$phpdig_string_subst['windows-1251'] = 'Q:Q,q:q'

// remove word wrapping in the below line 
$phpdig_words_chars['windows-1251'] =  '[:alnum:]ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞß*áâãäåæçèéêëì*îïðñòóôõö÷øùúûüýþÿ'


SavageNoName 12-31-2003 01:25 AM

Hi. I have made all corrections specified in message 1504. After that all works perfectly. Cyrillics everywhere is displayed and processed correctly.

One more small bug :)
After installation it is necessary in the table logs manually to create a field l_time (first letter L). Type of the data - TIME. If it to not make, the statistics in the admin-panel does not work.

Happy New Year :)

SavageNoName 12-31-2003 01:28 AM

P.S. After modification in a code, specified in the message 1504, it is necessary to re-index.

Charter 12-31-2003 01:35 AM

Hi. Great, glad it's working!

The l_time bug was fixed in version 1.6.3. Of course, if anyone created the tables prior to that, then they would need to do the following:
Code:

ALTER TABLE logs ADD l_time FLOAT DEFAULT '0' NOT NULL;
Please note it's FLOAT and not TIME.

>> Also, you will need to reindex for the changes to take effect.

Already there. ;)

Can you tell me what version of MySQL you are running and what is your MySQL character set?

SavageNoName 12-31-2003 01:59 AM

Please note it's FLOAT and not TIME.
Ops! :) Tnx, fixed.

version of MySQL you are running and what is your MySQL character set?
4.0.16 and ru-win1251


All times are GMT -8. The time now is 10:11 AM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.