Welcome Guest, Not a member yet? Register   Sign In
how to check if url exists
#3

lets re-phrase the question.

if someone enters a URL like : domain.com/elephant

does that URL cause an event like loading a view or does something else; id that what you mean ?

for a view you can do something in a controller like

Code:
public function showView($page)
{
    
    

$this->logic1= file_exists(APPPATH."Views/".$page.".php");

if( $this->logic1 == 1 )
{
load view
}
else

{

load view called info which states , page poes not exits
}



rout to pick up is :


Code:
$routes->get('(:any)','Pages::showView/$1');
//where Pages is a controller class and showView a method of the class using code above
CMS CI4 A CMS system, runs out of the box written on top of CI4
Arch Book  CodeIgniter4 on Apache(pages 92-114) 
Reply


Messages In This Thread
how to check if url exists - by cb21 - 04-12-2025, 11:58 PM
RE: hot to check if url exists - by kcs - 04-13-2025, 01:33 AM
RE: hot to check if url exists - by captain-sensible - 04-13-2025, 01:35 AM
RE: how to check if url exists - by InsiteFX - 04-14-2025, 10:31 PM



Theme © iAndrew 2016 - Forum software by © MyBB