Magento external Api Module - php

Good afternoon, I am making a module for Magento, I need help to connect it to an external API, essentially the channeladvisor API, and make some requests to this API, here my Module Code... I need to synchronize my inventory in channel advisor in my store made in magento
Config XML
<?xml version="1.0"?>
<!--
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_ImportExport:etc/import.xsd">
<entity name="CA_Import" label="Customer Group" model="Ibnab\Tutie\Model\Import\CustomerGroup" behaviorModel="Magento\ImportExport\Model\Source\Import\Behavior\Basic" />
</config>
Itegration XML
<integration name="TestIntegration">
<resources>
<!-- To grant permission to Magento_Log::online, its parent Magento_Customer::customer needs to be declared as well-->
<resource name="Magento_Customer::customer" />
<resource name="Magento_Log::online" />
<!-- To grant permission to Magento_Sales::reorder, all its parent resources need to be declared-->
<resource name="Magento_Sales::sales" />
<resource name="Magento_Sales::sales_operation" />
<resource name="Magento_Sales::sales_order" />
<resource name="Magento_Sales::actions" />
<resource name="Magento_Sales::reorder" />
</resources>
</integration>
i wanna implement this php consult in mi module:
PHP Code:
<?php
//Initialize test variables
$sku='zz-cf002-e';
$title='Game Set';
$subtitle='';
$shortdescription='Some Descriptive Text';
$description='More Descriptive Text';
$weight=1.1;
$total=14;
$cost=99;
$retailprice=99;
$startingprice=99;
$takeItprice=99;
$secondchanceofferprice=99;
$storeprice=99;
$classname='mahjong';
$attname1='Bullet_List';
$attvalue1='A list of bullet points';
$attname2='SHIPPING_BESTRATE';
$attvalue2='11.77';
$attname3='SHIPPING_BESTRATESERVICE';
$attvalue3='UPS Ground';
$image1='ZZ-CF002-E_a.jpg';
$image2='ZZ-CF002-E_b.jpg';
$image3='ZZ-CF002-E_c.jpg';
$image4='ZZ-CF002-E_d.jpg';
$usa_48_ups_ground=10;
$usa_48_ups_ground_2=7;
$usa_48_ups_2day=30;
$usa_48_ups_2day_2=15;
//Create the XML set
require_once('nusoap.php');
$client = new soapclient_xxx('https://api.channeladvisor.com/
ChannelAdvisorAPI/v1/inventoryService.asmx?WSDL', true );
$err = $client->getError();
if ($err)
{
echo 'Constructor error' . $err . '';
}
$developerKey = 'XXX';
$password = 'XXX';
$headers = '<APICredentials xmlns="http://api.channeladvisor.com/
webservices/">
<DeveloperKey>'.$developerKey.'</DeveloperKey>
<Password>'.$password.'</Password>
</APICredentials> ';
$arrData = array('accountID'=>'XXX',
'item'=>array(
'Sku'=>$sku,
'Title'=>$title,
'Subtitle'=>$subtitle,
'ShortDescription'=>$shortdescription,
'Description'=>$description,
'Weight'=>$weight,
'QuantityInfo'=>array(
'UpdateType'=>'Absolute', 'Total'=>$total),
'PriceInfo'=>array(
'Cost'=>number_format($cost, 2),
'RetailPrice'=>number_format($retailprice, 2),
'StartingPrice'=>number_format($startingprice, 2),
'ReservePrice'=>0,
'TakeItPrice'=>number_format($takeItprice, 2),
'SecondChanceOfferPrice'=>number_format($secondchanceofferprice, 2),
'StorePrice'=>number_format($storeprice, 2)),
'ClassificationInfo'=>array(
'Name'=>$classname, 'AttributeList'=>array(
'ClassificationAttributeInfo___1'=>array(
'Name'=>$attname1, 'Value'=>$attvalue1),
'ClassificationAttributeInfo___2'=>array(
'Name'=>$attname2, 'Value'=>$attvalue2),
'ClassificationAttributeInfo___3'=>array(
'Name'=>$attname3, 'Value'=>$attvalue3))),
'ImageList'=>array(
'ImageInfoSubmit___1'=>array(
'PlacementName'=>'ITEMIMAGEURL1',
'FilenameOrUrl'=>$image1),
'ImageInfoSubmit___2'=>array(
'PlacementName'=>'ITEMIMAGEURL2',
'FilenameOrUrl'=>$image2),
'ImageInfoSubmit___3'=>array(
'PlacementName'=>'ITEMIMAGEURL3',
'FilenameOrUrl'=>$image3),
'ImageInfoSubmit___4'=>array(
'PlacementName'=>'ITEMIMAGEURL4',
'FilenameOrUrl'=>$image4)),
'ShippingInfo'=>array(
'DistributionCenterCode'=>'Alhambra', 'ShippingRateList' =>array(
'ShippingRateInfo___1'=>array(
'DestinationZoneName'=>'USA48',
'CarrierCode'=>'* UPS',
'ClassCode'=>'GROUND',
'FirstItemRate'=>$usa_48_ups_ground,
'AdditionalItemRate'=>$usa_48_ups_ground_2,
'FirstItemHandlingRate'=>0,
'AdditionalItemHandlingRate'=>0,
'FreeShippingIfBuyItNow'=>'false',
'FirstItemRateAttribute'=>'Price',
'AdditionalItemRateAttribute'=>'Price'),
'ShippingRateInfo___2'=>array(
'DestinationZoneName'=>'USA48',
'CarrierCode'=>'UPS',
'ClassCode'=>'2DAY',
'FirstItemRate'=>$usa_48_ups_2day,
'AdditionalItemRate'=>$usa_48_ups_2day_2,
'FirstItemHandlingRate'=>0,
'AdditionalItemHandlingRate'=>0,
'FreeShippingIfBuyItNow'=>'false',
'FirstItemRateAttribute'=>'Price',
'AdditionalItemRateAttribute'=>'Price'))),
));
//fix repeating fields prior to send (eliminate ___1, ___2, etc.)
function array2xml($arrData, $level) {
$xml = '';
foreach( $arrData as $key => $value ) {
$spacer = '';
for ($i = 0; $i < $level; $i++) { $spacer .= "\t"; }
if ( is_array( $value ) ) {
if (preg_match("/^(.+)___\d+$/", $key, $m)) {
$xml .= $spacer . "<" . $m[1] . ">\n" . array2xml($value, $level
+1) . $spacer . "</" . $m[1] . ">\n";
} else {
$xml .= $spacer . "<" . $key . ">\n" . array2xml($value, $level
+1) . $spacer . "</" . $key . ">\n";
}
} else {
$xml .= $spacer . "<" . $key . ">" . $value . "</" . $key . ">\n";
}
}
return $xml;
}
//apply the function
$cleanedxml = '<SynchInventoryItem xmlns="http://
api.channeladvisor.com/webservices/">' . "\n" .
array2xml($arrData, 0) .
'</SynchInventoryItem>' . "\n";
// Call the SOAP method and send
$result = $client->call('SynchInventoryItem', $cleanedxml, false,
false, $headers);
//Print out the results
if ($client->fault)
{
echo 'Fault';
print_r($result);
echo '';
}
else
{
$err = $client->getError();
if ($err)
{
echo 'Error' . $err . '';
}
else
{
echo 'Result';
print_r($result);
echo '';
}
}
echo "<hr>";
echo '<h2>Request</h2>';
echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</
pre>';
echo '<h2>Response</h2>';
echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</
pre>';
?>

Related

Array: Compare values from API with values from own database

I have built a list (moviesSeen) where people can save their seen movies.
Now I want to get the director for each movie from an API and then compare which movies have already been seen. The output of the movies works without problems, but I can't get the result from the database (moviesSeen) to match the movies of the director. How can I achieve this?
The goal of the script is to show all movies of a director and mark all the ones you have already seen.
function getCrewDetails() {
global $apiKey;
global $language;
$personID = htmlspecialchars($_GET['personID']);
$url = "https://api.themoviedb.org/3/person/" . $personID . "?api_key=" . $apiKey . "&" . $language . "";// path to your JSON file
$data = file_get_contents($url); // put the contents of the file into a variable
$personPrivate = json_decode($data); // decode the JSON feed
echo '<div class="row">';
echo '<div class="col">';
echo '<img src="https://image.tmdb.org/t/p/w300/' . $personPrivate->profile_path . '" class="img-thumbnail">';
echo '</div>'; // end div col
echo '<div class="col-8">';
echo '<h1>' . $personPrivate->name . '</h1>';
if (!empty($personPrivate->biography)) {
echo $personPrivate->biography;
} else {
echo '<p>Verdammmt! Zu dieser Person liegen keine biographischen Details vor.</p>';
echo '<p>Dabei hätte sie es doch so verdient :(</p>';
}
echo '</div>'; // end div col
echo '</div>'; // end div row
// echo '<pre>';
// print_r($person);
$url = "https://api.themoviedb.org/3/person/" . $personID . "/movie_credits?api_key=" . $apiKey . "&" . $language . "";// path to your JSON file
$data = file_get_contents($url); // put the contents of the file into a variable
$personCareer = json_decode($data); // decode the JSON feed
echo '<div class="container mt-4">';
echo "<h2>Filmographie</h2>";
echo '<table class="table table-striped table-sm">';
echo '<thead>';
echo '<tr>';
echo '<th scope="col">Film</th>';
echo '<th scope="col">Gesehen</th>';
echo '<th scope="col">Funktion</th>';
echo '</tr>';
echo '</thead>';
echo '<tbody>';
global $pdo;
$stmt = $pdo->prepare("SELECT * FROM movieSeen WHERE user_id = '" . $_SESSION['id'] . "'");
$stmt->execute();
foreach ($stmt as $row ) {
echo $row['movie_id'] . ', ';
} // output of the saved IDs in movieSeen
foreach ($personCareer->crew as $showCrewDetails) { //Output of the movies
echo '<tr>';
echo '<td>' . $showCrewDetails->title . ' ' . $showCrewDetails->id . ' (' . substr($showCrewDetails->release_date, 0, 4) . ')</td>';
echo '<td><span class="badge badge-danger">Movie Seen</span></td>';
echo '<td>' . $showCrewDetails->job . '</td>';
echo '</tr>';
}
echo '</tbody>';
echo '</table>';
echo '</div>';
//echo '<pre>';
//var_dump($personCareer);
}
I know that I have to edit the last foreach loop, but I just can't get it to work :(

PHP get data form XML using PHPSimpleXML

I am trying to get data from an xml file and am having trouble as the table has a bit more levels than the examples I can find.
I want to be able to iterate through each instance of <Event> as <Information> and <Events> only open and close the data. The <Event> repeats based on the number of events logged.
A sample of the table structure is:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Information>
<Events>
<Event>
<Time>3141.29</Time>
<PrimaryObject ID="487">
<Name>Player1</Name>
<Country>us</Country>
</PrimaryObject>
<Action>Move</Action>
<SecondaryObject ID="814">
<Name>Dog</Name>
<Parent>487</Parent>
</SecondaryObject>
</Event>
</Events>
</Information>
The PHP code is:
<!DOCTYPE html>
<html>
<body>
<?php
$xml=simplexml_load_file("data.xml") or die("Error: Cannot create object");
foreach($xml->Event as $events) {
$id = $events->PrimaryObject->attributes();
$name = $events->PrimaryObject->Name;
...
echo $id['ID'].' '. $name;
echo "<br>";
}
?>
</body>
</html>
You have to use the Events
$xml->Events->Event as $events
For example
$xml=simplexml_load_file("data.xml") or die("Error: Cannot create object");
foreach($xml->Events->Event as $events) {
$id = $events->PrimaryObject->attributes();
$name = $events->PrimaryObject->Name;
echo $id['ID'].' '. $name;
echo "<br>";
}
Output
487 Player1
Php demo
I'm not sure what data exactly you are looking for, but here's everything, using xpath, and you can pick and choose:
$events = $xml->xpath('.//Event');
foreach($events as $event) {
$dat = $event->xpath('./PrimaryObject')[0];
$time= $event->xpath('./Time');
$id = $dat->xpath('./#ID');
$name = $dat->xpath('./Name');
$country = $dat->xpath('./Country');
$dat2 = $event->xpath('./SecondaryObject')[0];
$action= $event->xpath('./Action');
$id2 = $dat2->xpath('./#ID');
$name2 = $dat2->xpath('./Name');
$parent = $dat2->xpath('./Parent');
echo 'Time: ' . $time[0];
echo "<br>";
echo 'Action: ' . $action[0];
echo "<br>";
echo "<br>";
echo 'Primary Object Data:';
echo "<br>";
echo 'ID: ' . $id[0];
echo "<br>";
echo 'Name: ' . $name[0];
echo "<br>";
echo 'Country: ' . $country[0];
echo "<br>";
echo "<br>";
echo "<br>";
echo 'Secondary Object Data:';
echo "<br>";
echo 'ID: ' . $id2[0];
echo "<br>";
echo 'Name: ' . $name2[0];
echo "<br>";
echo 'Parent: ' . $parent[0];
echo "<br>";
}
Output:
Time: 3141.29
Action: Move
Primary Object Data:
ID: 487
Name: Player1
Country: us
Secondary Object Data:
ID: 814
Name: Dog
Parent: 487

Dependency of HTML rendering on function's return value that executes later?

I have a function that prints "Our data" first and then inside a loop checks for all the data in the database and then prints the data.
However, if there is no data, it shouldn't print "Our data", how do I achieve this since "Our data" is already printed?
The layout is as follows :
<h1> Our Data </h1>
<p> <!-- DATA --> </p>
The function is as follows:
function cpt_info($cpt_slug, $field_name, $title) {
echo "<h1>Our" . $title . "</h1>"; //here I want to print our data
$args = array('limit' => -1);
$cpt = pods($cpt_slug, $args);
$page_slug = pods_v('last', 'url');
echo "<h1 class='projects-under-" . $cpt_slug . "'>" . $title . "</h1>";
if ($cpt->total() > 0) :
while ($cpt->fetch()) :
if (!strcasecmp($cpt->field('post_name'), $page_slug)) :
$data = $cpt->field($field_name);
foreach ((array) $data as $key => $value) {
if ($value != null) : //here I check whether data is empty
$url = wp_get_attachment_url(get_post_thumbnail_id($value['ID']));
echo "<div class='col-sm-3 col-xs-6'><div class='border-to-circle'>";
echo "<div class='circle-container' style='background: url(" . $url . ")center center, url(" . get_template_directory_uri() . '/images/rwp-banner.jpg' . ")center center;'><h4><a href='" . get_permalink($value['ID']) . "'>" . $value['post_title'] . "</a></h4></div>";
echo "</div></div>";
endif;
}
endif;
endwhile;
endif;
}
Something like below:
if(count($data)){
echo '<h1> Our Data </h1>';
}

google checkout php callback explained

Hi all i don't know if i'm doing this right or not but i can't understand how google checkout works.
I have the php code that sends the XML to the google checkout everything is ok i reach on the checkout process taxes prices shipping is ok.
$_currency = $params['currency'];
$base_domain = 'https://' . (($params['mode'] == 'transaction') ? 'checkout.google.com' : 'sandbox.google.com/checkout');
$base_url = $base_domain . '/cws/v2/Merchant/' . $params['merchantId'] . '/checkout';
// Form XML array with cart items
$_items = '';
$google_products = $this->CI->go_cart->contents();
foreach ($google_products as $k => $v) {
$item_options = '';
if (isset($v['options'])) {
foreach ($v['options'] as $name => $value) {
if (is_array($value)) {
foreach ($value as $item) {
$item_options .= $item;
}
} else {
$item_options .= $value;
}
}
}
$_items .= '<item>' . '<merchant-item-id>' . $v['id'] . '</merchant-item-id>' . '<item-name>' . strip_tags($v['name']) . ' ' . $item_options . '</item-name>' . '<item-description>' . substr(strip_tags($item_options), 0, 299) . '</item-description>' . "<unit-price currency='" . $_currency . "'>" . $v['price'] . '</unit-price>' . '<quantity>' . $v['quantity'] . '</quantity>' . '</item>';
}
$xml_cart = "<?xml version='1.0' encoding='UTF-8'?>
<checkout-shopping-cart xmlns='http://checkout.google.com/schema/2'>
<shopping-cart>
<merchant-private-data>
<additional_data>
<session_id>" . base64_encode($customer['bill_address']["email"] . date('h:i:s')) . "</session_id>
<currency_code>" . $_currency . "</currency_code>
<payment_id>" . base64_encode($customer['bill_address']["email"] . date('h:i:s')) . "</payment_id>
" . $private_ship_data . "
</additional_data>
</merchant-private-data>
<items>" . $_items . "</items>
</shopping-cart>
<checkout-flow-support>
<merchant-checkout-flow-support>
<platform-id>971865505315434</platform-id>
<request-buyer-phone-number>true</request-buyer-phone-number>
<edit-cart-url>" . $edit_cart_url . "</edit-cart-url>
<merchant-calculations>
<merchant-calculations-url>" . $calculation_url . "</merchant-calculations-url>
</merchant-calculations>
<continue-shopping-url>" . $return_url . "</continue-shopping-url>
" . $shippings . $taxes . "
</merchant-checkout-flow-support>
</checkout-flow-support>
</checkout-shopping-cart>";
$signature = $this->fn_calc_hmac_sha1($xml_cart, $params['merchantKey']);
$b64_cart = base64_encode($xml_cart);
$b64_signature = base64_encode($signature);
echo '<form method="post" action="' . $base_url . '" name="BB_BuyButtonForm">
<input type="hidden" name="cart" value="' . $b64_cart . '" />
<input type="hidden" name="signature" value="' . $b64_signature . '" />
<input alt="" src="' . $base_domain . '/buttons/checkout.gif?merchant_id=' . $params['merchantId'] . '&w=160&h=43&style=' . 'white' . '&variant=text&loc=en_US" type="image"/>
</form>';
exit;
}
After i click on submit payment i'm then redirected to a page with successfull message and with a link to return to my website.
I'm wondering how can i check if the payment was or not successfully.
Also there is a callback that i don't know exactly what is supposed to do.
Please help me understand better
I have attached the code below.
Disclaimer: Am not a PHP dev.
Your code above is known as Part 1. Checkout API documented here. It covers how you get your data/cart to Google for Checkout
Part II. Order Processing covers how to get data from Google (into your systems). A tutorial is provided here. This is where you provide a Callback API URL that listens to (waits for) HTTP POSTs from Google and proceed to process the data.

HTML form - PHP not inserting into Database correctly

i'm only tring to make a form work.
Its a similar for than i am fillin now: question, text, tags.
Fine,
this is when i print the form
function imprimir_formulario_pregunta(){
$html = '<form id="pregunta" name ="pregunta" method="post" action="preguntas.php">';
$html .= '<h2>Pregunta</h2>';
$html .= '<input name="q" id="q" type="text" value=" "></input>';
$html .= '<h2>Explica tu duda</h2>';
$html .= '<textarea name="texto" id="texto" /
></textarea>';
$html .= '<h2>Etiquetas (separadas por comas)</h2>';
$html .= '<input name="tags" id="tags"/>';
$html .= '<input name="responde_a" style="display:none;" id="responde_a" value="0"/>';
$html .= '<button name="pregunta" id="pregunta" type="submit" >Publicar</button>';
$html .= '</form>';
echo $html;
}
this is when i recive data
if(isset($_POST['pregunta'])){
$p_title = $_POST['q'];
$p_text = $_POST['texto'];
$p_et = $_POST['etiquetas'];
$p_resp = $_POST['responde_a'];
post_pregunta($p_title,$p_text, $p_et, $p_resp);
this is when i process data
function obtener_id_pregunta($p,$t){
$consulta = mysql_query("SELECT * FROM preguntas WHERE pregunta='$p' && texto='$t'");
while($item = mysql_fetch_array($consulta)){
return $item['id'];
}
}
function post_pregunta($a,$t,$et,$r){
mostrar_notificacion("hemos entrado");
//// ******
if($a != '' && $t != ''){
$b = $a;
guardar_pregunta($b,$t,$r);
$id = obtener_id_pregunta($b,$t);
$temp = new etiqueta(0, '');
$basura = $temp->guardar_etiquetas($et, $id, $_SESSION['id']);
}else
mostrar_notificacion("hemos salido $a $t");
}
function guardar_pregunta($p,$t,$r){
$id_tmp = $_SESSION['id'];
$insert = "INSERT INTO preguntas (pregunta,texto,id_usuario,fecha,responde_a) VALUES ('$p','$t','$id_tmp',NOW(),'$r')";
$qry = mysql_query($insert);
if(mysql_affected_rows())
{
mostrar_notificacion("La pregunta $p ($t)($r) se guardo");
return true;
}
else
{
mostrar_notificacion("Error Ingresando datos");
return false;
}
return false;
}
Result:
I get the insert in the database done, but the 'q' field has a '' value....
Notes:
It looses the value in the step ** because it enters in the condition, but it doesn't in the next one wich is the same question...
Please tell me you have my answer, been too long on this.. and i need it done this week for class
Thanks in advance
It's hard to see what's going on - as #vincebowdren says, you just need to debug this every step of the way.
However, more worryingly you're using $_POST data directly in a SQL query - this is an SQL injection attack waiting to happen.
Ensure you wrap ALL such variables in a mysql_real_escape_string function within your queries.
e.g.:
$insert = "INSERT INTO preguntas (pregunta,texto,id_usuario,fecha,responde_a) VALUES ('".mysql_real_escape_string($p)."','".mysql_real_escape_string($t)."','$id_tmp',NOW(),'".mysql_real_escape_string($r)."')";
See How can I prevent SQL injection in PHP? for more information.
Use echo to print out the value of the troublesome variable ($_POST['q'], $p_title, $a) at every stage. Then you will see when it gets a value you weren't expecting.
#Toni Michel Caubet: I rewrote your code a little to make it more readable and should be slightly easier to debug as well. Please heed the /* comments */. I've left a lot of the work up to you with just some guides here and there.
Receive data:
if(isset($_POST['pregunta']))
{
$p_title = $_POST['q'];
$p_text = $_POST['texto'];
$p_et = $_POST['tags'];
$p_resp = $_POST['responde_a'];
/* Never trust user input, validate the data you're retrieving */
/* Keep variable names the same, or risk confusing yourself later */
post_pregunta($p_title, $p_text, $p_et, $p_resp);
}
Process data:
function post_pregunta($p_title, $p_text, $p_et, $p_resp)
{
mostrar_notificacion("hemos entrado");
/* You should handle validation like this after initially receiving post
data, the ideal would be to validate the data in a central location
and then only pass the valid data on to other functions to avoid
having to recheck everything.
*/
if($p_title != '' && $p_text != '')
{
guardar_pregunta($p_title, $p_text, $p_resp);
$id = obtener_id_pregunta($p_title, $p_text);
$temp = new etiqueta(0, '');
$basura = $temp->guardar_etiquetas($p_et, $id, $_SESSION['id']);
}
else
{
mostrar_notificacion("hemos salido $p_title $p_text");
}
}
function obtener_id_pregunta($p_title, $p_text)
{
/* This query may also be susceptible to SQL injection */
$consulta = mysql_query("SELECT id FROM preguntas WHERE pregunta='" . $p . "' AND texto='" . $t . "'");
while($item = mysql_fetch_array($consulta))
{
return $item['id'];
}
}
function guardar_pregunta($p_title, $p_text, $p_resp)
{
$id_tmp = $_SESSION['id'];
/* This query is susceptible to SQL injection not least because there's
no data validation. */
$insert = "INSERT INTO preguntas (pregunta, texto, id_usuario, fecha, responde_a) VALUES ('$p_title', '$p_text', '$id_tmp', NOW(), '$p_resp')";
$qry = mysql_query($insert);
if(mysql_affected_rows())
{
mostrar_notificacion("La pregunta $p_title ($p_text)($p_resp) se guardo");
return true;
}
else
{
mostrar_notificacion("Error Ingresando datos");
return false;
}
return false;
}
Print form:
function imprimir_formulario_pregunta()
{
$html = '<form id="preguntas" name="preguntas" method="post" action="preguntas.php">' . "\n";
$html .= ' <div>' . "\n";
$html .= ' <h2>Pregunta</h2>' . "\n";
$html .= ' <input name="q" id="q" type="text" />' . "\n";
$html .= ' </div>' . "\n";
$html .= ' <div>' . "\n";
$html .= ' <h2>Explica tu duda</h2>' . "\n";
$html .= ' <textarea name="texto" id="texto"></textarea>' . "\n";
$html .= ' </div>' . "\n";
$html .= ' <div>' . "\n";
$html .= ' <h2>Etiquetas (separadas por comas)</h2>' . "\n";
$html .= ' <input name="tags" id="tags" />' . "\n";
$html .= ' </div>' . "\n";
$html .= ' <div>' . "\n";
$html .= ' <input name="responde_a" style="display:none;" id="responde_a" value="0" />' . "\n";
$html .= ' <button name="pregunta" id="pregunta" type="submit">Publicar</button>' . "\n";
$html .= ' </div>' . "\n";
$html .= '</form>' . "\n";
echo $html;
}

Categories