Skocz do zawartości
Hosting webh.pl - 20%

Link w menu glównym

Rekomendowane odpowiedzi

Opublikowano

Mam problem z linkiem w menu głównym:

<li id='nav_custom_link' class='left'><a href='index.php?app=core&module=global&section=page'>Link</a></li>

Jeżeli jestem na stronie głównej, to działa poprawnie, jednak jeżeli wejdę w topic i użyję linku, to mam "stary link"+index.php?app=core&module=global&section=page

Chciałbym to jeszcze połączyć z przyjaznym linkiem.

Spróbowałem reguły

RewriteRule ^link$ index.php?app=core&module=global&section=page

I dodałem do mojego .htaccess

<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteRule ^link$ index.php?app=core&module=global&section=page
</IfModule>

Lecz bez efektu. Wrzucając podaną regułę przed RewriteRule . /index.php [L] w ogóle się sypie.

W tym to jestem zielony :]

Opublikowano
  • Autor

Dzięki, działa.

Tylko było trzeba usunąć "?" z tego kodu.

A jak przerobić to na przyjazny link? Tak by nie kolidowało z tym co już mam?

Edytowane przez melior

Opublikowano
  • Manager

Link będzie taki:

<a href="{parse url="app=core&module=global&section=page" template="custom_link_tpl" base="public"}">

Potem np. w pliku: admin/applications/forums/extensions/furlTemplates.php

Wstawiasz przed:

);

taki oto kod:

'custom_link_tpl'  => array( 
					'app'			=> 'core',
					'allowRedirect' => 0,
					'out'			=> array( '#app=core((&|&)module=global((&|&)section=page)?#i', 'custom_page/' ),
					'in'			=> array( 
												'regex'		=> "#/custom_page(/|$|\?)#i",
												'matches'	=> array( array( 'app', 'core' ),
																	  array( 'module', 'global' ),
																	  array( 'section', 'page' )  )
											) 
								),	

Nie zapomnij na końcu odświeżyć cache FURL - pojawi się monit, jak wejdziesz do ACP, że FURL-e wymagają aktualizacji.

Hahah, ciekawe czy się walnąłem, pisane z palca! :thumbsup:

intermedia - profesjonalne rozwiązania Invision Power Board, IC5

Opublikowano
  • Autor

Dodałem, przebudowałem.

W custom_page zostałem uraczony takimi komunikatami

 Warning: preg_match() [function.preg-match]: Compilation failed: missing ) at offset 55 in /home/strefarp/domains/strefarpg.o12.pl/public_html/admin/sources/base/ipsRegistry.php on line 1542  
Warning: Cannot modify header information - headers already sent by (output started at /home/strefarp/domains/strefarpg.o12.pl/public_html/admin/sources/base/ipsRegistry.php:1542) in /home/strefarp/domains/strefarpg.o12.pl/public_html/admin/sources/classes/output/formats/html/htmlOutput.php on line 109 
Warning: Cannot modify header information - headers already sent by (output started at /home/strefarp/domains/strefarpg.o12.pl/public_html/admin/sources/base/ipsRegistry.php:1542) in /home/strefarp/domains/strefarpg.o12.pl/public_html/admin/sources/classes/output/formats/html/htmlOutput.php on line 120
Warning: Cannot modify header information - headers already sent by (output started at /home/strefarp/domains/strefarpg.o12.pl/public_html/admin/sources/base/ipsRegistry.php:1542) in /home/strefarp/domains/strefarpg.o12.pl/public_html/admin/sources/classes/output/formats/html/htmlOutput.php on line 129
Warning: Cannot modify header information - headers already sent by (output started at /home/strefarp/domains/strefarpg.o12.pl/public_html/admin/sources/base/ipsRegistry.php:1542) in /home/strefarp/domains/strefarpg.o12.pl/public_html/admin/sources/classes/output/formats/html/htmlOutput.php on line 130
Warning: Cannot modify header information - headers already sent by (output started at /home/strefarp/domains/strefarpg.o12.pl/public_html/admin/sources/base/ipsRegistry.php:1542) in /home/strefarp/domains/strefarpg.o12.pl/public_html/admin/sources/classes/output/formats/html/htmlOutput.php on line 134

Edytowane przez melior

Opublikowano
  • Autor
<?php

if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
$_SEOTEMPLATES = array(

'showannouncement'     => array( 'app'		     => 'forums',
								 'allowRedirect' => 1,
								 'out'           => array( '#showannouncement=(.+?)((?:&|&)f=(.+?))?(&|$)#i', 'forum-$3/announcement-$1-#{__title__}/$4' ),
						  		 'in'            => array( 'regex'   => "#/forum-(\d+?)?/announcement-(\d+?)-#i",
												 		   'matches' => array( array( 'showannouncement', '$2' ), array( 'f', '$1' ) ) ) ),

'showforum'     => array( 'app'		      => 'forums',
						  'allowRedirect' => 1,
						  'out'           => array( '#showforum=(.+?)(&|$)#i', 'forum/$1-#{__title__}/$2' ),
						  'in'            => array( 'regex'   => "#/forum/(\d+?)-#i",
												    'matches' => array( array( 'showforum', '$1' ) ) ) ),

'showtopic'     => array( 'app'		      => 'forums',
						  'allowRedirect' => 1,
						  'out'           => array( '#showtopic=(.+?)(&|$)#i', 'topic/$1-#{__title__}/$2' ),
						  'in'            => array( 'regex'   => "#/topic/(\d+?)-#i",
											        'matches' => array( array( 'showtopic', '$1' ) ) ) ),

'act=idx'       => array( 'app'		      => 'forums',
						  'allowRedirect' => 0,
						  'out'           => array( '#act=idx(&|$)#i', 'index$1' ),
						  'in'            => array( 'regex'   => "#/index(/|$|\?)#i",
											        'matches' => array( array( 'act', 'idx' ) ) ) ),
'custom_link_tpl'  => array( 
                                               'app'                   => 'core',
                                               'allowRedirect' => 0,
                                               'out'                   => array( '#app=core((&|&)module=global((&|&)section=page)?#i', 'custom_page/' ),
                                               'in'                    => array( 
                                                                                                       'regex'         => "#/custom_page(/|$|\?)#i",
                                                                                                       'matches'       => array( array( 'app', 'core' ),
                                                                                                                                                 array( 'module', 'global' ),
                                                                                                                                                 array( 'section', 'page' )  ) ) )

);

Opublikowano
  • Manager

@up: na pewno nie..

A tak:

<?php

if ( ! defined( 'IN_IPB' ) )
{
       print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
       exit();
}
$_SEOTEMPLATES = array(

       'showannouncement'     => array( 'app'               => 'forums',
                                                                        'allowRedirect' => 1,
                                                                        'out'           => array( '#showannouncement=(.+?)((?:&|&)f=(.+?))?(&|$)#i', 'forum-$3/announcement-$1-#{__title__}/$4' ),
                                                                        'in'            => array( 'regex'   => "#/forum-(\d+?)?/announcement-(\d+?)-#i",
                                                                                                                          'matches' => array( array( 'showannouncement', '$2' ), array( 'f', '$1' ) ) ) ),

       'showforum'     => array( 'app'               => 'forums',
                                                         'allowRedirect' => 1,
                                                         'out'           => array( '#showforum=(.+?)(&|$)#i', 'forum/$1-#{__title__}/$2' ),
                                                         'in'            => array( 'regex'   => "#/forum/(\d+?)-#i",
                                                                                                           'matches' => array( array( 'showforum', '$1' ) ) ) ),

       'showtopic'     => array( 'app'               => 'forums',
                                                         'allowRedirect' => 1,
                                                         'out'           => array( '#showtopic=(.+?)(&|$)#i', 'topic/$1-#{__title__}/$2' ),
                                                         'in'            => array( 'regex'   => "#/topic/(\d+?)-#i",
                                                                                                       'matches' => array( array( 'showtopic', '$1' ) ) ) ),

       'act=idx'       => array( 'app'               => 'forums',
                                                         'allowRedirect' => 0,
                                                         'out'           => array( '#act=idx(&|$)#i', 'index$1' ),
                                                         'in'            => array( 'regex'   => "#/index(/|$|\?)#i",
                                                                                                       'matches' => array( array( 'act', 'idx' ) ) ) ),
'custom_link_tpl'  => array( 
                                               'app'                   => 'core',
                                               'allowRedirect' 		=> 0,
                                               'out'                   => array( '#app=core((&|&)module=global((&|&)section=page)?#i', 'custom_page/' ),
                                               'in'                    => array( 
                                                                                                       'regex'         => "#/custom_page(/|$|\?)#i",
                                                                                                       'matches'       => array( 

																															) 
																			) 
						)

);

intermedia - profesjonalne rozwiązania Invision Power Board, IC5

Jeśli chcesz dodać odpowiedź, zaloguj się lub zarejestruj nowe konto

Ostatnio przeglądający 0

  • Brak zarejestrowanych użytkowników przeglądających tę stronę.

Szukaj

Szukaj

Skonfiguruj powiadomienia push w przeglądarce

Chrome (Android)
  1. Stuknij ikonę kłódki obok paska adresu.
  2. Stuknij Uprawnienia → Powiadomienia.
  3. Dostosuj swoje ustawienie.
Chrome (Komputer)
  1. Kliknij ikonę kłódki na pasku adresu.
  2. Wybierz Ustawienia witryny.
  3. Znajdź Powiadomienia i dostosuj swoje ustawienie.