Can I loop inside a variable using HTML_Template_Sigma in PHP?

I have to use the HTML_Template_Sigma PEAR Module to do an assignment on PHP that basically wraps all the HTML of a website to make templates with it instead of pasting the same HTML over and over. The thing is that all the content is added using variables and at some point I have to loop through an array inside one of the string variables (which has a table inside). So I checked the documentation which is not really abundant and it does have some sort of loop implementation but oriented to publications and I don't know how to use it to solve my problem.

Still what they show is not exactly the same as this.

foreach ($data as $result) { $plantilla->setCurrentBlock('table_row'); $plantilla->setVariable(array( 'date' => $result[0], 'epicentre' => $result[1], 'region' => $result[2], 'richter' => $result[3], 'mercalli' => $result[4] )); $plantilla->parseCurrentBlock('table_row'); }

This is my variable:

content = ' <table> <thead> <tr> <th>Date</th> <th>Epicentre</th> <th>Region</th> <th>Mw Richter</th> <th>Mercalli</th> </tr> </thead> <tbody> <!-- BEGIN table_row --> <tr> <td>{date}</td> <td>{epicentre}</td> <td>{region}</td> <td>{richter}</td> <td>{mercalli}</td> </tr> <!-- END table_row --> </tbody> </table>';

My array contains 5 columns of data. I've tried but to no avail.

Thanks in advance!

Category:php Views:5 Time:2018-07-07
Tags: php html pear

Related post

  • Set Session variable using javascript in PHP 2010-08-28

    Is it possible to set PHP session variables using Javascript? --------------Solutions------------- In javascript: jQuery('#div_session_write').load('session_write.php?session_name=new_value'); In session_write.php file: <? session_start(); if (iss

  • share an url with multiple url variables using facebook sharer.php 2011-11-14

    I have an url i would like users to share using facebook sharer.php[title]=$title>&p[summary]=$descp&p[images][0]=$image&p[url]=$url) where $url is the url i would like to share. the struc

  • How can I read a Google Spreadsheets using jquery and php 2011-12-19

    I have some information in Google Spreadsheets as a single sheet. Is there any way by which I can read this information from html by jquery and php. my sheet link and my username [email protected] password Pattu&1991 --------------Solutions------

  • How can we configure Google Custom search using API with PHP 2012-02-23

    I would like to use the Google Custom Search API, May i know how can we use it on PHP language. for ex:- <?php $keyword = "Demo Test" ; $URL = "

  • How can I change a JavaScript variable using Greasemonkey? 2011-04-19

    This is the page that I am trying to modify, I want to bypass the countdown timer, how should I write the script? Is there a way that I can change the variable document.licenseform.btnSubmit.disabled to yes using Greasemonkey? <html> <head

  • Can I refer to a variable using a string? 2010-08-25

    Say I have the following JS: var foo_index = 123; var bar_index = 456; And the following HTML: <div id="foo"></div> <div id="bar"></div> Then I'd like to say this: thisIndex = + '_index' And I'd like thisIndex to be a

  • can we access a private variable using an object 2011-03-08

    We cannot access a private variable of a class from an object, which is created outside the class, but it is possible to access when the same object is created inside the class, itself. why?? class Program { private int i; public void method1() { Pro

  • How can you implement a condition variable using semaphores? 2011-03-19

    A while back I was thinking about how to implement various synchronization primitives in terms of one another. For example, in pthreads you get mutexes and condition variables, and from these can build semaphores. In the Windows API (or at least, old

  • How can I loop through a List using the template-method pattern? 2012-03-11

    I'm looking for an example implementation of the template-method pattern in Java. Suppose, for example, I'd like to create a generic class that can loop through a List<T> and execute a template method with signature void execute(T t) on each it

  • How can i set an integer variable using stored procedure 2009-11-24

    exec SP_HastaIcmal_AktifKaliciHastalar 25 it returns 86. DECLARE @iAktifKaliciHastalar int SET @iAktifKaliciHastalar = exec SP_HastaIcmal_AktifKaliciHastalar 25 that code return error. Msg 156, Level 15, State 1, Line 3 Incorrect syntax near the keyw

  • Can I initialize an int variable using the new keyword and passing the value into int constructor 2011-01-01

    I'm running this code and getting a compile time error please have a look at it: class test { public static void main(String []args) { int age=new int(20); System.out.println("My age is " + age); } } --------------Solutions------------- int is not a

  • Can't seem to pass variable using select_tag 2011-12-23

    I have a form in Rails that I need to create an option tag in HTML. It's a pretty simple option list with static values. I could create it in HTML easy enough, but I want to do it the "Rails Way" Here is a portion of my form: <div class="field"

  • Can I initialize a class variable using a global variable? (ruby) 2010-02-27

    Do I have create extra method for this kind of assignment? @@variable = @global_variable Why? I want to have some variables that hold values and definitions to be accessible all through my script and have only one place of definition. @global_variabl

  • How can I navigate from a variable using webbrowser.navigate()? 2011-06-08

    I want to open a webpage from the webbrowser control. However, the address is not fully known: string site = "page.php"; webBrowser1.Navigate(""); How can I do this properly? --------------Solutions------------- Erm, not su

  • How do you loop through json when using ajax with php and jquery? 2011-04-03

    I have a <input> that displays suggestions when someone types in it. I am building the backend to it so that ajax grabs the first five tags in the database that have that letter sequence and displays it in spans in particular <div>. I don

  • How to assign Session Variables using Jquery and PHP? 2012-02-20

    I have a autocomplete combobox which holds the list of the suppliers and when an item is selected it will store the ID inside a session and a hidden field. Here's my current code: <script> (function( $ ) { $.widget( "ui.combobox", { _create: fu

  • why i can not do sql injection testing using mysql and php 2011-06-15

    i was trying to check a web site for an sql injection attack and amazed to see it not very very simple to prevent because below is the simple code . $sql="select * from user_acount where login_id='".$username."' and password='".$password."' and statu

  • How can I create a file upload using jQuery and php? 2011-07-21

    how can i create a jQuery multiple image upload(upload without refresh page after choose file only displaying image not insert to databse) and submit additional Form Data and submit all with click on button without refresh page data insert to databas

  • Can't access row with 'fieldName' using MAX() in PHP MYSQL 2012-02-10

    I have small PHP script which has $query = "SELECT MAX(id) FROM `dbs`"; //query run $row = mysql_fetch_array($result); $val = $row[0]; Which runs fine, but I want to understand why i can't access the row with the fieldname, like if i have this $query

  • I can't include while loop inside of a variable 2012-04-12

    I have a string : <? $home = '<ul> <li> first line </li> // Here I want to write some while loop// <li> second line </li> </ul>'; // somewhere on the bottom of the page I echo $home ?> I can't seperate home v

  • Imacros for FireFox - Loop Inside EVAL 2011-11-30

    I need to reload URL (in this case to refresh same page) until I don't have word beginning with capitalized A, B or C. How can I loop inside EVAL? Can somebody please provide me with some code example? VERSION BUILD=7401110 RECORDER=FX TAB T=1 URL GO

  • sending two variables using httpresponse 2011-05-30

    foo = t.render(// blah blah //) bar = t1.render(// blah blah //) How can I send both these variables using HttpResponse. --------------Solutions------------- Using JSON, XML, CSV or any other format. I don't really understand what you want to achieve

  • How to setenv (set environment variable) using mainmenu nib (xib) file in Cocoa or Xcode programming? 2011-12-24

    I am new to both Cocoa programming and Xcode. I am wondering how I can setenv (or set environment variable) using MainMenu.nib (or .xib) file. I have someone else's code in the main function like this: [NSApplication sharedApplication]; [NSBundle loa

  • How can I set an environment variable in a cross-platform way? 2012-02-14

    I can easily read an environment variable using System.Environment.getEnv. However, System.Environment does not have any corresponding setEnv function (as far as I could tell). How do I set an environment variable from a Haskell program? I would pref

  • Modify Javascript Variable Using Greasemonkey 2012-04-16

    Help, can anyone help me how to change javascript variable using greasemonkey? I already following the answers on this question: How can I change a JavaScript variable using Greasemonkey? and also this link:

Copyright (C), All Rights Reserved.

processed in 0.117 (s). 11 q(s)