Home State Codes and Statutes

State Codes and Statutes

State Codes and Statutes

[insert_php]

$actual_link = “https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]”;
$actual_link = str_replace(“://”, “”, $actual_link);
$actual_link = rtrim($actual_link, “/”);
//echo $actual_link;
$link_array = explode(“/”, $actual_link);

if (count($link_array) > 0)
{
if (strpos($link_array[0], “http”) !== false)
{
unset($link_array[0]);
}
}
//var_dump($link_array);
// switch – case
$state = “”;
$title = “”;
$chapter = “”;
$section = “”;
global $wpdb;
switch(count($link_array))
{
case 1:
{
$state = $link_array[1];
$stat_id = $wpdb->get_results( ‘SELECT pageurl,cat_name FROM `zy_statutes` WHERE parent_id = (select id from `zy_statutes` where post_slug = “‘.$state.'”) order by id asc’);

echo “Statutes > “.ucfirst($state).”

“;
foreach ( $stat_id as $stat_ids )
{
print ‘Statutes > “.ucfirst($state).” > “.ucfirst($title).”

“;

foreach ( $stat_id as $stat_ids )
{
print ‘Statutes > “.ucfirst($state).” > “.ucfirst($title).” > “.ucfirst($chapter).”

“;
if ($stat_content->content != ”)
{
print $stat_content->content;
}
else
{
$stat_id = $wpdb->get_results( ‘SELECT pageurl,cat_name FROM `zy_statutes` WHERE parent_id = (select id from `zy_statutes` where post_slug = “‘.$chapter.'” and parent_id=(select id from `zy_statutes` where post_slug= “‘.$title.'” and parent_id=(select id from `zy_statutes` where post_slug= “‘.$state.'”))) order by id asc’);

foreach ( $stat_id as $stat_ids )
{
print ‘Statutes > “.ucfirst($state).” > “.ucfirst($title).” > “.ucfirst($chapter).” > “.ucfirst($section).”

“;
if ($stat_content->content != ”)
{
print $stat_content->content;
}
else
{
$stat_id = $wpdb->get_results( ‘SELECT pageurl,cat_name FROM `zy_statutes` WHERE parent_id = (select id from `zy_statutes` where post_slug = “‘.$section.'” and parent_id=(select id from `zy_statutes` where post_slug= “‘.$chapter.'” and parent_id=(select id from `zy_statutes` where post_slug= “‘.$title.'” and parent_id=(select id from `zy_statutes` where post_slug= “‘.$state.'”)))) order by id asc’);

foreach ( $stat_id as $stat_ids )
{
print ‘Statutes > “.ucfirst($state).” > “.ucfirst($title).” > “.ucfirst($chapter).” > “.ucfirst($section).” > “.ucfirst($subsection).”

“;
if ($stat_content->content != ”)
{
print $stat_content->content;
}
break;
}
default:
{
echo “page not found”;
}
}

[/insert_php]