Pessoal,
existe algum programa que agrupa seletores que tem as mesmas propriedades, para diminuir o código, ou tem que fazr tudo na mão mesmo?
- Fórum WMO
- → Viewing Profile: Tópicos: kboing
Community Stats
- Group Usuários
- Active Posts 77
- Profile Views 2550
- Member Title Normal
- Age Age Unknown
- Birthday Birthday Unknown
-
Sexo
Não informado
2
Neutral
User Tools
Friends
kboing hasn't added any friends yet.
Latest Visitors
Topics I've Started
Existe Programa Para Agrupar Seletores (css)?
12/03/2009, 09:39
Como Saber Quanto Um Script Php Gasta De Recurso?
23/02/2009, 11:07
Tem alguma forma de saber quanto um script php gasta de recurso, como quanto gasta de memoria, consumo de cpu, etc?
Buscar Mais Vistos E Ordernar Por Ordem Alfabetica
09/02/2009, 16:21
Como montar uma busca mysql em um script php da seguinte forma:
fazer uma busca para mostrar apenas os 5 topicos mais vistos e ordena-los em ordem alfabetica:
exemplo de tabela:
id | nome | vistos |
1 | a | 2 |
2 | b | 1 |
3 | c | 7 |
4 | d | 4 |
5 | e | 9 |
6 | f | 0 |
7 | g | 6 |
8 | h | 10 |
9 | i | 8 |
10 | j | 1 |
em ordem decrescente seria: h e i c g
mas depois de pegar os mais vistos, teria q coloca-los em ordem alfabetica
o resultado seria: c e g h i
como montar essa busca?
fazer uma busca para mostrar apenas os 5 topicos mais vistos e ordena-los em ordem alfabetica:
exemplo de tabela:
id | nome | vistos |
1 | a | 2 |
2 | b | 1 |
3 | c | 7 |
4 | d | 4 |
5 | e | 9 |
6 | f | 0 |
7 | g | 6 |
8 | h | 10 |
9 | i | 8 |
10 | j | 1 |
em ordem decrescente seria: h e i c g
mas depois de pegar os mais vistos, teria q coloca-los em ordem alfabetica
o resultado seria: c e g h i
como montar essa busca?
Xml_parse - Erro Na Leitura De 2 Urls
03/06/2008, 18:33
fiz um script utilizando "xml_parse" para ler 2 arquivos xml, mas apos ler o primeiro arquivo dá o erro "PHP Fatal error: Cannot redeclare startelement()" e não lê o segundo arquivo.
como fazer para ler os dois arquivos?
SCRIPT:
<?PHP
$xmlurls = array(
"file1.xml",
"file2.xml"
);
for($i = 0; $url = $xmlurls[$i]; $i++) {
$insideitem = false;
$item = array();
$tag = "";
$title = "";
$link = "";
function startElement($parser, $name, $attrs) {
global $insideitem, $tag, $title, $link, $item;
if ($insideitem) {
$tag = $name;
} elseif ($name == "ITEM") {
$insideitem = true;
}
}
function endElement($parser, $name) {
global $insideitem, $tag, $title, $link, $item, $attrs;
if ($name == "ITEM") {
echo "$title : $link";
}
}
function characterData($parser, $data) {
global $insideitem, $tag, $title, $link, $pubdate, $description, $item, $attrs;
if ($insideitem) {
switch ($tag) {
case "ITEM":
$id .= $item['ID'];
break;
case "TITLE":
$title .= $data;
break;
case "LINK":
$link .= $data;
}
}
}
$xml_parser = xml_parser_create("");
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");
$fp = fopen("$url","r")
or die("Error reading data.");
while ($data = fread($fp, 4096))
xml_parse($xml_parser, $data, feof($fp))
or die(sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
fclose($fp);
xml_parser_free($xml_parser);
}
?>
se alguem puder ajudar, agradeço.
como fazer para ler os dois arquivos?
SCRIPT:
<?PHP
$xmlurls = array(
"file1.xml",
"file2.xml"
);
for($i = 0; $url = $xmlurls[$i]; $i++) {
$insideitem = false;
$item = array();
$tag = "";
$title = "";
$link = "";
function startElement($parser, $name, $attrs) {
global $insideitem, $tag, $title, $link, $item;
if ($insideitem) {
$tag = $name;
} elseif ($name == "ITEM") {
$insideitem = true;
}
}
function endElement($parser, $name) {
global $insideitem, $tag, $title, $link, $item, $attrs;
if ($name == "ITEM") {
echo "$title : $link";
}
}
function characterData($parser, $data) {
global $insideitem, $tag, $title, $link, $pubdate, $description, $item, $attrs;
if ($insideitem) {
switch ($tag) {
case "ITEM":
$id .= $item['ID'];
break;
case "TITLE":
$title .= $data;
break;
case "LINK":
$link .= $data;
}
}
}
$xml_parser = xml_parser_create("");
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");
$fp = fopen("$url","r")
or die("Error reading data.");
while ($data = fread($fp, 4096))
xml_parse($xml_parser, $data, feof($fp))
or die(sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
fclose($fp);
xml_parser_free($xml_parser);
}
?>
se alguem puder ajudar, agradeço.
Simplexml_load_file
03/04/2008, 18:28
Como pegar os dados (como tilte ou keywords) deste exemplo de xml usando simplexml_load_file
<media:group>
<media:title type="plain">TITULO</media:title>
<media:description type="plain">AQUI DESCRICAO</media:description>
<media:keywords>PALAVRA1, PALAVRA2, PALAVRA3</media:keywords>
<yt:duration seconds="270" />
<media:category label="Test" scheme="http://teste.com.br"...media:category>
<media:player url="http://www.teste.com.br/teste1" />
<media:thumbnail url="http://www.teste.com...br/teste12.jpg" height="97" width="130" time="02:15" />
<media:thumbnail url="http://www.teste.com...br/teste11.jpg" height="97" width="130" time="01:07" />
<media:thumbnail url="http://www.teste.com...br/teste13.jpg" height="97" width="130" time="03:22" />
</media:group>
consigo pegar dados de xmls padrão, com namespaces não estou conseguindo. Se alguém puder ajudar, agradeço.
<media:group>
<media:title type="plain">TITULO</media:title>
<media:description type="plain">AQUI DESCRICAO</media:description>
<media:keywords>PALAVRA1, PALAVRA2, PALAVRA3</media:keywords>
<yt:duration seconds="270" />
<media:category label="Test" scheme="http://teste.com.br"...media:category>
<media:player url="http://www.teste.com.br/teste1" />
<media:thumbnail url="http://www.teste.com...br/teste12.jpg" height="97" width="130" time="02:15" />
<media:thumbnail url="http://www.teste.com...br/teste11.jpg" height="97" width="130" time="01:07" />
<media:thumbnail url="http://www.teste.com...br/teste13.jpg" height="97" width="130" time="03:22" />
</media:group>
consigo pegar dados de xmls padrão, com namespaces não estou conseguindo. Se alguém puder ajudar, agradeço.
- Fórum WMO
- → Viewing Profile: Tópicos: kboing
- Privacy Policy
- Regras ·