can anyone tell me how url routing works and how to load a page as it done in joomla![]()
can anyone tell me how url routing works and how to load a page as it done in joomla![]()
What do you mean? Can you give an example?
Generally, domain names are sent to various levels of DNS (domain name servers) until the signal reaches the host. Then the request URI (basically URL) is parsed by the server and the right page is served.
Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
priya.mehta111 (04-23-2010)
hii and thank you so much for you interest
Acutally i m trying to make cms in which i would like to load the components by spliting of url and then load the components like
"index.php?option=com_content&view=section&id=4" split this url like
option=com_contents,
view=section
id=4,
it means actually the url have to load the main folder components and look for the folder content, and then look at the folder section, where it will get the code to publish my webpage content as it defined in section folders view.php;
for this example the path what script need to follow is :
joomladomain.com/components/com_content/views/section/view.html.php
see this directory if you have joomla installed on your system
I think thats just using php includes or requires and conditional statements for the values. http://php.net/manual/en/function.include.php http://php.net/manual/en/function.require.php
For example my page I have:
domain structure:PHP Code:<?php
$page_sub = $_GET['sec'];
$page_on = $_GET['id'];
?>
<a href="?id=develop" <?php if ($page_on === "develop") { echo "id=\"page_on\"";}?>>Development</a>
<a href="?id=fun" <?php if ($page_on === "fun") { echo "id=\"page_on\"";}?>>Chris Activities</a>
<?php
if ($page_on === "fun") {
require("fun.php");
}
if ($page_on === "develop") {
require ("develop.php");
}
?>
site.com/?id=fun or site.com/index.php?id=fun
the section I have set up is used on my fun or develop section.
Corrections to my coding/thoughts welcome.
priya.mehta111 (04-23-2010)
dear i m looking to resolve the url like index.php?option=vlaue&view=solution&id=12&type=reg
like this can handle as many parameters pass to it, the content can be stored and can follow the the directory folder path which will be generate dynamically from the url or if the url is wrong or broken then it will redirect to an error page else redirect to the destination folder to load the content on the page, this is my actual problem what i want to solve.![]()
You can do that with conditional ifs or switchs
This is a simplish break down if the domain structure were like site.com/?page=1&user=123. This is not good coding...
PHP Code:<?php
if (isset($_GET['page'];) {
$page_on = $_GET['page'];
if ($page_on == "1" ) {
$page_on = "home")
}
} else {
$page_on = "";
}
if (isset($_GET['user'];) {
$user = $_GET['user'];
}
?>
<h1>Welcome to the Home Page
<?php
if ($user == "123") {
?>
John.</h1>
<?php
} else {
?>
.<br /><span style="color:#ff0000;">Please login.</span></h1>
}
} else {
?>
Error Page not found.
<?php
}?>
Corrections to my coding/thoughts welcome.
Bookmarks