why people making bad codes with PHP
Many people reason is: “I got this code from a tutorial.”
(More …)
Many people reason is: “I got this code from a tutorial.”
(More …)
happens when you try to use JSON data on JQGrid. your JSON is probably fine, but your initiation code probably wrong.
if this happened to you, try to do
repeatitems : false
on the options for the initiation
$menu = &JSite::getMenu();
$active = $menu->getActive();
///if the active menu is empty means you are in front page
if(!$active)
$active = $menu->getDefault();
$Itemid = $active->id;
<?php echo count(false);?>
above code will give you 1 as a result. so becareful if you do a test on a function that returning a boolean
The following takes a list of news items from an XML file (or an RSS feed), assigning it to an array first for a name value pair and then generating an HTML list.
<?php
$xml =<<<EOT
<?xml version="1.0" encoding="ISO-8859-1"?>
<news>
<item>
<title>News 1</title>
<created>04/2/2010 08:00 EST</created>
<url>http://news.example.com/news.pdf</url>
</item>
<item>
<title>News 2</title>
<created>04/25/2010 08:00 EST</created>
<url>http://news.example.com/news.pdf</url>
</item>
<item>
<title>News 3</title>
<created>04/27/2010 08:00 EST</created>
<url>http://news.example.com/news.pdf</url>
</item>
</news>
EOT;
$doc = new DOMDocument();
if ($doc->loadXML($xml)) {
$items = $doc->getElementsByTagName('item');
$headlines = array();
foreach($items as $item) {
$headline = array();
if($item->childNodes->length) {
foreach($item->childNodes as $i) {
$headline[$i->nodeName] = $i->nodeValue;
}
}
$headlines[] = $headline;
}
if(!empty($headlines)) {
$hc = 0;
echo '<ul>';
foreach($headlines as $headline) {
if(++$hc <= 3) {
echo '<li>'
.'<a href="'.$headline['url'].'" target="_blank">'
.'<span>'.date('F j, Y', strtotime($headline['created'])).'</span><br />'
.$headline['title']
.'</a>'
.'</li>';
}
}
echo '</ul>';
}
}
from http://www.php.net/manual/en/domdocument.getelementsbytagname.php#97608
Data Type | Storage Required |
TINYINT |
1 byte |
SMALLINT |
2 bytes |
MEDIUMINT |
3 bytes |
INT ,INTEGER
|
4 bytes |
BIGINT |
8 bytes |
FLOAT( |
4 bytes if 0 <= p <= 24, 8 bytes if 25<= p <= 53 |
FLOAT |
4 bytes |
DOUBLE [PRECISION] ,REAL
|
8 bytes |
DECIMAL( ,NUMERIC(
|
Varies; see following discussion |
BIT( |
approximately (M +7)/8 bytes |
Data Type | Storage Required |
DATE |
3 bytes |
TIME |
3 bytes |
DATETIME |
8 bytes |
TIMESTAMP |
4 bytes |
YEAR |
1 byte |
Data Type | Storage Required |
CHAR( |
M × w bytes,0 <= 255, where w isthe number of bytes required for the maximum-length character in the character set |
BINARY( |
M bytes, 0 <= 255 |
VARCHAR( ,VARBINARY(
|
L + 1 bytes if column values require 0– 255 bytes, L + 2 bytesif values may require more than 255 bytes |
TINYBLOB ,TINYTEXT
|
L + 1 bytes, whereL <28 |
BLOB , TEXT
|
L + 2 bytes, whereL <216 |
MEDIUMBLOB ,MEDIUMTEXT
|
L + 3 bytes, whereL <224 |
LONGBLOB ,LONGTEXT
|
L + 4 bytes, whereL <232 |
ENUM(' |
1 or 2 bytes, depending on the number of enumeration values (65,535 values maximum) |
SET(' |
1, 2, 3, 4, or 8 bytes, depending on the number of set members (64 members maximum) |
PHP Tutorials Examples PHP Recursive Array To XML With DOM
This class provides a method to recursively create XML from a PHP array. The functionality is provided by extending the built in Document Object Model (DOM) class. By extending the DOM class, all the functions within are available locally to the array2xml class. The main engine in this class is the createNode method, which is a recursive function that adds the child nodes to the parent root directory.
http://idn.interspire.com/categories/Email-Marketer/
that link is not very complete. i spent hours just to make the sample working. it is not very tricky though. here was my problem. i was trying to integrate IEM with joomla. i followed the sample, and the sample needs the usertoken. i tried to look up everywhere on the installation, but i couldnt find it. so i looked up on the database directly. yes it was there. but it more than 64 character. i tried to put it on the sample code, and ofcourse it wasnt going to work anyway.
i relooked up on the admin panel of IEM. and LOL i found a check box “enable this user to use xml API”. click save. and then it gives you the correct API token. copy paste that token, and the sample is working.
the PHP code is still the same as the sample on the link. just copy paste that.
preg_match_all("#(\w+)=\[(.*?)\]#s", $param_line, $matches);
sample string = {gallery width=[129] url=[http://google.com] height=[122]}
Do you do custom work on Virtuemart websites? I need help in changing the way virtuemart works for a client i have. I have asked a couple of developers if they can make the changes i want but they have not been any help.
Basically i want virtuemart to show all products in a big list like the link shows. And function the same way as the large table of products shows.
would there be a way to do the drop down menu’s as well.
Thank you,
Wes
http://register.rcmusic.ca/rcms/capricorn?para=calendarWelcome
my website i am providing is the website i am currently working on.
what you can do is make a menu that link to a certain category. and put browse_1, or browse_2,browse_3 or browse_4 or browse_5 in browse page text box form
try all of those type of .
you need to create your own browse page if you cant find what are you looking for on those 5 type of browse pages.
just try that first and see what happens.
Reply