PHP代码和元标记的问题

时间:2018-02-08 01:24:01

标签: php html facebook

我在一个小问题上需要一些帮助,

我需要你在PHP中修改一些行

问题是什么: 当我们在facebook facebook上分享我们的页面时,它附带

<ol> <li> <span><p>

例如帖子上的第二行是这样的!

<ol> <li>Oversee the safety and compliance programs for all the facilities operated by PWSAC.

enter image description here

&#13;
&#13;
<?php error_reporting(0);
$user_data=$this->session->userdata('session_user_data');
$f=$this->uri->segment('1');
$p=$this->uri->segment('2');
$i=$this->uri->segment('3');
//echo $apply_url=$f.'/'.$p.'/'.$i; exit;
$this->session->set_userdata('session_apply_job_url',$apply_url);

$image=base_url().'img/user.png';
if(@$company_details[0]->logo!=''){
  if (file_exists('./upload/user/resize/'.$company_details[0]->logo)){
     $image=base_url().'upload/user/resize/'.$company_details[0]->logo;
   }
}
$selectSkill='';
$skill_arr=array();
$selectSkill=@$candidate_profile[0]->skills;
if(!empty($selectSkill)){
	$skill_arr=explode(',',$selectSkill);
	}
$client_ip=$this->Common->get_client_ip();	
$job_visits=$this->Common->selectMultiWhere('tbl_job_visits',$where=array('ip_addtess'=>$client_ip,'job_id'=>$i));	
if(empty($job_visits)){
	$this->db->insert('tbl_job_visits',array('ip_addtess'=>$client_ip,'job_id'=>$i,'user_id'=>@$this->userId,'date'=>date('Y-m-d h:i:s')));
	}
$related_jobs=array();	
if(!empty($selectSkill)){
	$related_jobs=$this->Common->related_jobs($selectSkill);
	}	
		
//echo '<pre>';print_r($user_data[0]->ID);exit;

 ?>
 <style>
 .btn-disable_b {
  background-color: #c0c0c0;
  color: #c0c0c0;
  cursor: not-allowed;
  display: inline-block;
  pointer-events: none;
}
.bg-whit.newmainAdd { background: #f5f5f5 !important;}
 </style>

<!--<div id="main">
    <div id="container"></div>
    Keep Going!
</div>
<div id="footer">You Made It!</div>-->

<section class="wow fadeIn no-padding-bottom newmainAdd" id="main">
<div class="container">
	<div class="row">
		<div class="col-md-8 col-sm-7 col-xs-12 bg-aqt">
            <div class="leftModal newadd1">
            <div class="full p-r-15">
              <div class="jobDescription">
                <div class="jobDescriptionLeft"> <img src="<?php echo $image; ?>" alt="<?php if(isset($candidate_profile[0]->job_title)){echo $candidate_profile[0]->job_title;}?>"> </div>
                <div class="jobDescriptionRight">
                  <h2>
                  <?php echo glang('Jobs at');?> <?php if(isset($users_info[0]->company_name)){echo $users_info[0]->company_name;}?> : <?php if(isset($candidate_profile[0]->job_title)){echo $candidate_profile[0]->job_title;}?> <?php echo glang('in');?> <?php if(isset($job_description[0]->location)){echo $job_description[0]->location;}?> - <?php echo glang('AquacultureTalent');?>
                  
                   
                  </h2>
                  <h3><span>
                    <?php 
					//$arr = substr($str, 0, strpos($str, '('));
					if($job_description[0]->role_description!=''){
						$arr = explode(".", $job_description[0]->role_description, 2);
						echo  $arr[0].'.';
					}
					?>
                    </span></h3>
                </div>
              </div>
              <div class="fullTimeArea full">
                <ul>
                  <li>
                    <?php if(isset($job_description[0]->job_type)){if($job_description[0]->job_type=='fulltime'){echo 'Full-time';}else if($job_description[0]->job_type=='contract'){echo 'Contract';}elseif($job_description[0]->job_type=='parttime'){echo 'Part-time';}else{echo 'Full-time';}} ?>
                  </li>
                  <li><i class="fa fa-calendar"></i> <?php echo $this->Common->time_passed(strtotime($post_jobs_info[0]->approved_date)); ?> </li>
                  <li><i class="fa fa-map-marker"></i><a href="javascript:;">
                    <?php if(isset($job_description[0]->location)){echo $job_description[0]->location;}?>
                    </a></li>
                  <?php if($job_description[0]->show_salary==1){ ?>
                  <li><i class="fa fa-eur"></i><a href="javascript:;" data-toggle="tooltip" data-placement="top" title="Gross Anual Salary">
                    <?php if(isset($job_description[0]->gross_salary_low)){echo $job_description[0]->gross_salary_low;}?>
                    -
                    <?php if(isset($job_description[0]->gross_salary_high)){echo $job_description[0]->gross_salary_high;}?>
                    </a></li>
                  <?php } ?>
                  <!--<li><i class="fa fa-bar-chart-o"></i> Intermediate</li>-->
                  <li><a href="javascript:;" data-toggle="tooltip" title="Preferred spoken language!"><i class="fa fa-language"></i>
                    <?php if(isset($candidate_profile[0]->language)){echo $candidate_profile[0]->language;}?>
                    </a></li>
                  <li> <i class="fa fa-briefcase abs"></i>
                    <ul>
                      <li><a href="javascript:;"><span>
                        <?php if(isset($position_category[0]->title)){echo $position_category[0]->title;}?>
                        </span></a></li>
                    </ul>
                  </li>
                  <li> <i class="fa fa-tags abs"></i>
                    <ul>
                      <?php for($i=0;count($skill_arr)>$i;$i++){ ?>
                      <?php $skill_category=$this->Common->selectMultiWhere('tbl_talent_profile_option',$where=array('optionsId'=>$skill_arr[$i])); ?>
                      <li><a href="javascript:;"><span><?php echo $skill_category[0]->title; ?></span></a></li>
                      <?php }?>
                    </ul>
                  </li>
                </ul>
              </div>
              <div class="offerSection full">
                <?php if(isset($job_description[0]->role_description)){echo $job_description[0]->role_description;}?>
              </div>
              <div class="offerSection full">
                <h3><?php echo glang('Main requirements');?></h3>
                <?php if(isset($job_description[0]->main_requirements)){echo $job_description[0]->main_requirements;}?>
              </div>
              <div class="offerSection full">
                <h2><?php echo glang('Nice to have');?></h2>
                <?php if(isset($job_description[0]->nice_to_have)){echo $job_description[0]->nice_to_have;}?>
              </div>
              <div class="offerSection full">
                <h2><?php echo glang('Perks');?></h2>
                <?php if(isset($job_description[0]->perks)){echo $job_description[0]->perks;}?>
              </div>
            </div> 
          </div>
  		</div>
  		<div class="col-md-4 col-sm-5 col-xs-12" >
            <div class="" >
              <div class="full" id="container">
                <div class="rightModal newadd2">
                  <?php
                    $string=$candidate_profile[0]->job_title;
                    $string_slug=$this->Common->create_slug($string);
                    $i=$this->uri->segment('3');
                    
                  
                   if(!empty($user_data)){ 
                   $student_application_details=$this->Common->selectMultiWhere('tbl_job_application_list',$where=array('applicant_id'=>$this->userId));
                    $application_array=array();
                    foreach($student_application_details as $row){
                        $application_array[]=$row->job_id;
                    }
                   
                    ?>
                  <?php if($this->userRoll==3 || $this->userRoll==2 || $this->userRoll==4){ ?>
                  <a class="applyNow button-3d btn-disable" href="javascript:;"><?php echo glang('apply');?></a>
                  <?php }else{?>
                  <?php if(in_array($i,$application_array)){?>
                  <a class="applyNow button-3d btn-disable" href="javascript:;"><?php echo glang('Already applied');?></a>
                  <?php }else{ ?>
                  <a class="applyNow button-3d" href="<?php echo base_url()?>apply-job/<?php echo $string_slug?>/<?php echo $p;?>"><?php echo glang('apply now');?></a>
                  <?php } ?>
                  <?php } ?>
                  <?php }else{ ?>
                  <a class="applyNow button-3d" href="<?php echo base_url();?>login?login_for=apply"><?php echo glang('Sign up to apply');?></a>
                  <?php } ?>
                  <div class="full m-t-30"> 
                    
                    <?php if(!empty($user_data)){?>
                    <?php $bookmark_info=$this->Common->selectMultiWhere('tbl_bookmarks',$where=array('user_id'=>$user_data[0]->ID)); 
                        $bookmark_array=array();
                        foreach($bookmark_info as $row){
                            $bookmark_array[]=$row->job_id;
                        }
                    ?>
                    <?php if($this->userRoll==3 || $this->userRoll==2 || $this->userRoll==4){ ?>
                    <div id="bookmarksBtn" class="btn-disable_b"> <a class="bookmarksBtn m-t-20  <?php if(in_array($i,$bookmark_array)){ echo 'remove_bookmark active';}else{echo 'add_bookmark';} ?>" data-id="<?php echo $i;?>" href="javascript:;"><i class="fa fa-bookmark"></i>
                      <?php if(in_array($i,$bookmark_array)){ echo   glang('Remove Bookmark');}else{ echo glang('Bookmark'); } ?>
                      </a> </div>
                    <?php }else{ ?>
                    <div id="bookmarksBtn"> <a class="bookmarksBtn m-t-20  <?php if(in_array($i,$bookmark_array)){ echo 'remove_bookmark active';}else{echo 'add_bookmark';} ?>" data-id="<?php echo $i;?>" href="javascript:;"><i class="fa fa-bookmark"></i>
                      <?php if(in_array($i,$bookmark_array)){ echo glang('Remove Bookmark');}else{ echo glang('Bookmark');     } ?>
                      </a> </div>
                    <?php } ?>
                    <?php }else{ ?>
                    <a class="bookmarksBtn m-t-20" href="<?php echo base_url();?>login?login_for=apply"><i class="fa fa-bookmark"></i> <?php echo glang('Sign up to Bookmark');?></a>
                    <?php } ?>
                  </div>
                  <div class="full shereArea m-t-30">
                    <h4><?php echo glang('SHARE');?></h4>
                    <ul>
                      <li><a href="http://www.facebook.com/sharer.php?u=<?php echo base_url()?>offer-details/<?php echo $string_slug?>/<?php echo $i;?>" target="_blank"><i class="fa fa-facebook"></i></a></li>
                      <li class="twit"><a href="https://twitter.com/share?url=<?php echo base_url()?>offer-details/<?php echo $string_slug?>/<?php echo $i;?>&amp;text=AquacultureTalent – Connecting The Best Talent To Amazing Companies&amp;hashtags=" target="_blank"><i class="fa fa-twitter"></i></a></li>
                      <li class="linkD"><a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=<?php echo base_url()?>offer-details/<?php echo $string_slug?>/<?php echo $i;?>" target="_blank"><i class="fa fa-linkedin"></i></a></li>
                      <li class="mail2"><a href="mailto:?Subject=  Jobs from AquacultureTalent&amp;Body=<?php echo base_url()?>offer-details/<?php echo $string_slug?>/<?php echo $i;?>" class="ssbp-btn ssbp-email ssbp-email-popup" data-ssbp-title="Jobs from AquacultureTalent" data-ssbp-url="<?php echo base_url()?>offer-details/<?php echo $string_slug?>/<?php echo $i;?>" data-ssbp-site="Email" target="_blank"><i class="fa fa-envelope"></i></a></li>
                    </ul>
                  </div>
                  <div class="full shereArea m-t-50">
                    <h4><?php echo glang('Related job offers');?></h4>
                    <div class="clearfix"></div>
                    <ul class="full offerspart">
                      <?php foreach($related_jobs as $r_job){ ?>
                      <?php if($r_job->id!=$i){ ?>
                      <?php $string=$r_job->job_title;
                      $string_slug=$this->Common->create_slug($string);
                      ?>
                      <li><a href="<?php echo base_url()?>offer-details/<?php echo $string_slug?>/<?php echo $r_job->id; ?>">
                        <h5>
                          <?php if(isset($r_job->job_title)){ echo $r_job->job_title;} ?>
                        </h5>
                        <p>
                          <?php if(isset($r_job->company_name)){ echo $r_job->company_name;} ?>
                        </p>
                        </a></li>
                      <?php } ?>
                      <?php } ?>
                    </ul>
                  </div>
                </div>
              </div>
            </div>
          </div>
	</div>
</div>
  
  
  <div class="clearfix"></div>
</section>
<script>
$(document).on('click', '.add_bookmark', function() {
	var id = $(this).data('id');
	$.ajax({
		url: base_url + 'apply/add_bookmark',
		type: 'post',
		data: {id: id},
		dataType: 'json',
		beforeSend: function(){
			 //$(self).parent().addClass('active');
			},
		complete: function(data){
			$("#bookmarksBtn").load(location.href + " #bookmarksBtn>*", "");
			},
		success: function(json){},
		error: function(xhr, ajaxOptions, thrownError) {
			alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
		}
	});
}); 
$(document).on('click', '.remove_bookmark', function() {
	var id = $(this).data('id');
	var self = this;
	$.ajax({
		url: base_url + 'apply/remove_bookmark',
		type: 'post',
		data: {id: id},
		dataType: 'json',
		beforeSend: function() {
			//$(self).parent().parent().children('.bookmark').removeClass('active');
			},
		complete: function(data) {
			$("#bookmarksBtn").load(location.href + " #bookmarksBtn>*", "");
			},
		success: function(json) {},
		error: function(xhr, ajaxOptions, thrownError) {
			alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
		}
	});
});
$(".clickIcon").click(function(){
    $(".dashLeft").toggleClass("dashLeft-left");
}); 
</script> 
<script>
$(document).ready(function(){
    $('[data-toggle="tooltip"]').tooltip();
});
</script> 
<script type="text/javascript" >
    jQuery(document).ready(function($){
        //variables
        var $window = $(window);
        var $container = $("#container");
        var $main = $("#main");
        var window_min = 0;
        var window_max = 0;
        var threshold_offset = 50;
        /*
         set the container's maximum and minimum limits as well as movement thresholds
         */
        function set_limits(){
            //max and min container movements
            var max_move = $main.offset().top + $main.height() - $container.height() - 2*parseInt($container.css("top") );
            var min_move = $main.offset().top;
            //save them
            $container.attr("data-min", min_move).attr("data-max",max_move);
            //window thresholds so the movement isn't called when its not needed!
            //you may wish to adjust the freshhold offset
            window_min = min_move - threshold_offset;
            window_max = max_move + $container.height() + threshold_offset;
        }
        //sets the limits for the first load
        set_limits();

        function window_scroll(){
            //if the window is within the threshold, begin movements
            if( $window.scrollTop() >= window_min && $window.scrollTop() < window_max ){
                //reset the limits (optional)
                set_limits();
                //move the container
                container_move();
            }
        }
        $window.bind("scroll", window_scroll);

        /**
         * Handles moving the container if needed.
         **/
        function container_move(){
            var wst = $window.scrollTop();
            //if the window scroll is within the min and max (the container will be "sticky";
            if( wst >= $container.attr("data-min") && wst <= $container.attr("data-max") ){
                //work out the margin offset
                var margin_top = $window.scrollTop() - $container.attr("data-min");
                //margin it down!
                $container.css("margin-top", margin_top);
                //if the window scroll is below the minimum
            }else if( wst <= $container.attr("data-min") ){
                //fix the container to the top.
                $container.css("margin-top",0);
                //if the window scroll is above the maximum
            }else if( wst > $container.attr("data-max") ){
                //fix the container to the top
                $container.css("margin-top", $container.attr("data-max")-$container.attr("data-min")+"px" );
            }
        }
        //do one container move on load
        container_move();
    });
</script>
&#13;
&#13;
&#13;

2 个答案:

答案 0 :(得分:0)

如果您访问此作业:https://aquaculturetalent.com/offer-details/123/hatchery-operation-manager并查看其来源,您会看到以下代码:

<meta name="description" content="<p>The Hatchery Operations Manager basic functions:</p>
<ol>
<li>Oversee all non-fish culture hatchery operations and staff involved with these tasks including the M/V Alaskan Challenger</li>
<li>Prepare annual budgets with hatchery managers for each facility and the annual budget for the Anchorage Distribution Center to present the General Manager/CEO</li>
<li>To work on a daily basis with the General Manager/CEO and members of the top management team to carry out the directives of the Board</li>
<li>Oversee the safety and compliance programs for all the facilities operated by PWSAC.">

注意content=内的HTML。在该行的某个位置,您未正确关闭liolmeta标记。更新后端代码,将这些数据填充为有效的HTML,应该没问题。

答案 1 :(得分:0)

在将内容放入元描述之前,您需要过滤以删除标记并转义HTML实体,无论发生在何处。实施例...

<?php
$desc = "<p>The Hatchery Operations Manager basic functions</p>";
$desc_sanitized = filter_var($desc, FILTER_SANITIZE_STRING);
echo '<meta name="description" content="' . htmlspecialchars($desc_sanitized) . '">';