Skip to content

Commit 0e4d433

Browse files
committed
fixed snake case conversion for paths.
1 parent 05a4d91 commit 0e4d433

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Mvc/Views/Html.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,14 @@ public function render( array $Data ): string
4141
$Path = "$BasePath/resources/views";
4242
}
4343

44-
$ControllerName = new NString( $this->getController() )->toSnakeCase();
44+
// Convert controller name to snake_case, preserving directory separators
45+
$controllerParts = explode( '/', $this->getController() );
46+
$snakeCaseParts = array_map(
47+
fn( $part ) => ( new NString( $part ) )->toSnakeCase(),
48+
$controllerParts
49+
);
50+
$ControllerName = implode( '/', $snakeCaseParts );
51+
4552
$View = "$Path/$ControllerName/{$this->getPage()}.php";
4653

4754
if( !file_exists( $View ) )

0 commit comments

Comments
 (0)