Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QUESTION How to use function from plugin in theme?
#1
Exclamation 
Hey guys I am fairly new to GetSimple and have been given the task of doing some updates/changes to a site made on GetSimple by a previous person. I am struggling with this particular task: the plugins lists out some things that were added via admin. Then when a person clicks 'view details' on a given item in the frontend it previously took you to another page where the relevant details are shown via url parameters.

But, what I want to do is when the view details is clicked a modal pops up with the details, I have got the id passing into the modal, now how could I call a function in the plugin that is responsible for the details ?

Code for listing out the jobs:
Code:
function include_jobs(){
    global $jobs_list;
    $jobs_list = read_jobs_from_file();
    
    if (count($jobs_list) > 0){
        echo("<div class='panel-group'>");
        for ($iterator = 0; $iterator < count($jobs_list); $iterator++){
            $jobs = $jobs_list[$iterator];        
            ?>    
   <div class="panel panel-default">
     <div class="panel-heading">
       <h4 class="panel-title">
         <a data-toggle="collapse" href="<?php echo "#".$jobs['jobID'];?>"><?php echo $jobs['title'];?></a>
       </h4>
     </div>
     <div id="<?php echo $jobs['jobID'];?>" class="panel-collapse collapse">
       <div class="panel-body"><div><?php echo $jobs['salary'];?></div><div><?php echo $jobs['location'];?></div></div>
       <div class="panel-footer"><a class="job-apply-button" href="#job-description" data-id="<?php echo $jobs['jobID'];?>" data-toggle="modal" title="">
                        <span>View job details</span>
                    </a></div>
     </div>
   </div>
            <?
        }
        echo("</div>");
    }
    
}

Code for include the details:
Code:
function include_job_details(){
    
    global $jobs_list;
    $jobs_list = read_jobs_from_file();
    
    
        //find the job details to output
        $iterator = 0;
        $job = array();
        for ($iterator = 0; $iterator < count($jobs_list); $iterator++){
            $job = $jobs_list[$iterator];
            if ($job['jobID'] == $_GET['jobID']){
                break;
            }
        }
        ?>    
        <div class="job-listing-middle">
            <span class="job-title"><?php echo $job['title'];?></span><span class="job-location"><?php echo $job['location'];?></span>
            <span class="job-salary"><?php echo $job['salary'];?></span>
            <span class="job-description" style="margin-top:5px"><?php echo $job['description'];?></span>
        </div>
        <div class="job-listing-button">
            <span class="job-tag">Click to apply online</span>
            <div class="job-button-container">
                <a class="job-apply-button" href="./<?php printf("./apply-for-a-job?jobID=%s&title=%s", $_GET['jobID'], urlencode($job['title']));  ?>" title="">
                    <span>Apply Online</span>
                </a>
            </div>
        </div>
        <?php
        
}
Reply


Messages In This Thread
How to use function from plugin in theme? - by vish93 - 2016-05-23, 18:52:24



Users browsing this thread: 1 Guest(s)