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
#2
If you know the name of the plugin, you can ask about it in the Plugin's support thread, which you can usually find via a link on the Plugin's download page in Extend. Also, there's usually info on configuration on the plugin page and in the support thread.
Reply
#3
(2016-05-23, 19:11:08)datiswous Wrote: If you know the name of the plugin, you can ask about it in the Plugin's support thread, which you can usually find via a link on the Plugin's download page in Extend. Also, there's usually info on configuration on the plugin page and in the support thread.

First of all thank you very much for taking time to reply, I appreciate your aid. I had a look in hope but the plugin is a custom one and not listed there I believe, I have just in hope tried calling the function like such: myfunction(); directly in the theme template.php and it works, I just need to now figure out how I can extract the id that is being passed into the modal
Reply
#4
Just curious what is the name of the plugin's file in the plugins folder?
Reply
#5
(2016-05-23, 19:45:36)datiswous Wrote: Just curious what is the name of the plugin's file in the plugins folder?

John_doe_custom
Reply




Users browsing this thread: 1 Guest(s)