Gallery2RSS module으로 싸우고 "아직 피드가 정의되지 않았습니다"라는 메시지 만 표시되면서 포기했습니다. a Google search for "no feeds have yet been defined"을 기준으로 볼 때 이는 매우 일반적인 문제입니다. Gallery2 RSS 모듈을 사용하기위한 팁이나 트릭이 있습니까? 또는 상대적으로 PHP를 모르는 개발자가이 PHP 애플리케이션의 문제점을 디버깅하려고 할 때 유용한 정보가 있습니까?Gallery2의 RSS 피드
0
A
답변
1
이 문제에 대한 궁극적 인 해결책은 Python CGI 스크립트입니다. 내 스크립트는 유용하다는 것을 알 수있는 모든 사람을 대상으로합니다 (이것이 총 해킹 임에도 불구하고).
#!/usr/bin/python
"""A CGI script to produce an RSS feed of top-level Gallery2 albums."""
#import cgi
#import cgitb; cgitb.enable()
from time import gmtime, strftime
import MySQLdb
ALBUM_QUERY = '''
select g_id, g_title, g_originationTimestamp
from g_Item
where g_canContainChildren = 1
order by g_originationTimestamp desc
limit 0, 20
'''
RSS_TEMPLATE = '''Content-Type: text/xml
<?xml version="1.0"?>
<rss version="2.0">
<channel>
<title>TITLE</title>
<link>http://example.com/gallery2/main.php</link>
<description>DESCRIPTION</description>
<ttl>1440</ttl>
%s
</channel>
</rss>
'''
ITEM_TEMPLATE = '''
<item>
<title>%s</title>
<link>http://example.com/gallery2/main.php?g2_itemId=%s</link>
<description>%s</description>
<pubDate>%s</pubDate>
</item>
'''
def to_item(row):
item_id = row[0]
title = row[1]
date = strftime("%a, %d %b %Y %H:%M:%S GMT", gmtime(row[2]))
return ITEM_TEMPLATE % (title, item_id, title, date)
conn = MySQLdb.connect(host = "HOST",
user = "USER",
passwd = "PASSWORD",
db = "DATABASE")
curs = conn.cursor()
curs.execute(ALBUM_QUERY)
print RSS_TEMPLATE % ''.join([ to_item(row) for row in curs.fetchall() ])
curs.close()
-2
글쎄, 내가 당신을 도울 수 확실하지 오전하지만 여기에 또 다른 항목의 해결책으로 제시 한 아주 간단한 RSS이다
은