		<!DOCTYPE html>
<html lang="en">
	<head>

 <link rel="canonical" href="<?= $url ?>" > 

		<meta charset="utf-8">
<?php header('Content-Type: text/html; charset=utf-8'); ?>
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<title><?php echo $title;?></title>
		<meta name="description" content="<?php echo $meta;?>">
		<meta name="author" content="Lawbamba">

<?php
$current_url = $_SERVER['REQUEST_URI'];
$last_segment = $this->uri->segment($this->uri->total_segments());

$noindex = false;

/* block index.php URLs */
if (strpos($current_url, 'index.php') !== false) {
    $noindex = true;
}

/* block pagination page 2+ only */
if (is_numeric($last_segment) && intval($last_segment) > 1) {
    $noindex = true;
}

if ($noindex) {
    echo '<meta name="robots" content="noindex,follow">';
}
?>
			
			<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5">

			<link rel="shortcut icon" href="https://www.lawbamba.com/assets/images/favicon.ico"> 
<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "WebSite",
  "name": "Lawbamba",
  "url": "https://www.lawbamba.com/"
}
</script>

<link rel="preload" as="image" href="/assets/lawyer_photos/Lawyer.webp" fetchpriority="high">
<?php require "zipcss.inc"; ?>

<meta property="og:site_name" content="Lawbamba">
<meta property="og:title" content="Lawbamba">
<meta property="og:description" content="Lawbamba Lawyers Social">
<meta property="og:image" content="https://www.lawbamba.com/og-image.png">
<meta property="og:url" content="https://www.lawbamba.com">

<meta name="twitter:title" content="Lawbamba">
<meta name="twitter:description" content="Lawbamba Lawyers Social">
<meta name="twitter:url" content="https://www.lawbamba.com/twitter-image.png">
<meta name="twitter:card" content="summary">


<?php
$visible = array_slice(isset($lawyers) ? $lawyers : [], 0, 5000);

$makeUrl = function($r) {
    $slug = strtolower(trim(preg_replace('/[^a-z0-9]+/i', '-', isset($r->lawyer_name) ? $r->lawyer_name : 'lawyer')));
    return site_url('lawyer/' . (isset($r->id) ? $r->id : 0) . '/' . $slug . '-reviews-ratings');
};


$legalServices = [];
foreach ($visible as $i => $row) {
    $url = $makeUrl($row);
    $obj = [
        "@type" => "LegalService",
        "@id"   => $url,
        "name"  => isset($row->lawyer_name) ? $row->lawyer_name : '',
        "url"   => $url,
        "image" => "https://www.lawbamba.com/assets/images/Lawbamba-Logo2.webp",
        "address" => [
            "@type" => "PostalAddress",
            "streetAddress"   => isset($row->street_name) ? $row->street_name : '',
            "addressLocality" => isset($row->city) ? $row->city : '',
            "addressRegion"   => isset($row->more_info) ? $row->more_info : '',
            "postalCode"      => isset($row->zip) ? $row->zip : '',
            "addressCountry"  => "US"
        ],
        "telephone"   => isset($row->phone) ? $row->phone : '',
        "areaServed"  => array($zipcodep, isset($row->zip) ? $row->zip : $zipcodep)
    ];

    $rv = (float)(isset($row->rating_value) ? $row->rating_value : 0);
    $rc = (int)(isset($row->rating_count) ? $row->rating_count : 0);
    if ($rv > 0 && $rc > 0) {
        $obj["aggregateRating"] = [
            "@type" => "AggregateRating",
            "ratingValue" => (string)$rv,
            "reviewCount" => (string)$rc
        ];
    }

    $legalServices[] = $obj;
}

$itemList = [
    "@type" => "ItemList",
    "name"  => $issuep . " Lawyers in " . $zipcodep,
    "itemListOrder" => "https://schema.org/ItemListOrderDescending",
    "itemListElement" => array_map(
        function($row, $i) use ($makeUrl) {
            return [
                "@type" => "ListItem",
                "position" => $i + 1,
                "item" => ["@id" => $makeUrl($row)]
            ];
        },
        $visible,
        array_keys($visible)
    )
];

$graph = array_merge(array($itemList), $legalServices);
?>
<script type="application/ld+json">
<?= json_encode(
    array(
        "@context" => "https://schema.org",
        "@graph"   => $graph
    ),
    JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT
) ?>
</script>

	</head>
 	
<?php

$connection = mysqli_connect("localhost", "root", "l@wbamba.Db@2o2e", "lawbamba");
if (mysqli_connect_errno()) {
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
   // exit();
}

?>			

<body> 
