Foren / Cotonti / Core Labs / Archive / add "item available" to list.php

ez
#1 31. Dezember 2009, 04:46
In list.inc.php i do not see the following code.. (see page.inc.php for the same code)
It would be nice to add it there. That way I can detect if a page should be on the list or not. Also I want to show the "NON" published items to admins and owners only.
Also I made 1 tag in page called "PAGE_AVAILABLE" that i can use in xtemplate to make my skin programming simpler.. (and would like that in list too)
The PAGE_AVAILABLE tag i also added to page.inc.php.

Tell me what you all think....

In list.inc.php (2 tiny corehacks):
//============================
// LLS start modification	
//============================
if ($pag['page_begin']>$sys['now_offset'])
{
	$pag['page_text'] = $L['pag_notavailable'].sed_build_timegap($sys['now_offset'], $pag['page_begin_noformat']);
	$t->assign("PAGE_TEXT", $pag['page_text']);
// LLS modification	
	$t->assign("PAGE_AVAILABLE", "0");
	}
else
{
	$t->assign("PAGE_AVAILABLE", "1");

//============================
// LLS END modification
//============================

==- I say: Keep it EZ -==

Dieser Beitrag wurde von ez (am 31. Dezember 2009, 17:30, vor 14 Jahre) bearbeitet
rayblo
#2 31. Dezember 2009, 04:48
You have a working example m8?
[b]www.dutchcotonti.com[/b]<br />
De plaats voor nederlandse ondersteuning voor Cotonti.<br />
The place for support for Cotonti in Dutch
ez
#3 31. Dezember 2009, 17:02
I am buidling a community site for chessplayers in the Netherlands...
My demo site (still not live) is at http://schaaksite.2basix.nl/

I use this as follows:
<!-- BEGIN: LIST_ROW -->
	<!-- IF {LIST_ROW_IAMTHEOWNER}="1" OR {PAGE_AVAILABLE}="1" OR {PHP.usr.isadmin}="1" -->
	<tr>
		<td>
			<h4><a href="{LIST_ROW_URL}">{LIST_ROW_TITLE}</a></h4>
			<p class="small">{LIST_ROW_DESC}</p><br />
			<!-- IF {IMGR1_SRC} -->
				<a href="{LIST_ROW_URL}"><img width="{IMGR1_WIDTH}" height="{IMGR1_HEIGHT}" alt="Kunst" title="{LIST_ROW_TITLE}" src="{IMGR1_SRC}"/></a>
			<!-- ENDIF -->
		</td>
	</tr>
	<!-- ENDIF -->
<!-- END: LIST_ROW -->



there are a few tags in here that are mine:
{IMGR1_xxx} is a custom plugin I build for resizing imgs to different sizes in different places.
{PAGE_AVAILABLE} Code is in first post:
{LIST_ROW_IAMTHEOWNER} also a new tag i build:
     
"LIST_ROW_IAMTHEOWNER" => $usr['id']==$pag['page_ownerid'] ? '1' : '0',	

Anyway i think this could be usefull for the next version (maybe)???
==- I say: Keep it EZ -==

Dieser Beitrag wurde von ez (am 31. Dezember 2009, 17:28, vor 14 Jahre) bearbeitet
Kilandor
#4 31. Dezember 2009, 17:48
I don't see any reason to add this to core sorry, its something totaly custom.

The IAMTHEOWNER could be done via tpl.
The page avail you should be able to do via Custom fields and TPL
Same for the Image thing, can be done with extra fields
ez
#5 31. Dezember 2009, 18:02
Hi Kilandor,
thnx for the response :)
How can i do this: "The IAMTHEOWNER could be done via tpl."

For the other items, i cannot use xtra fields (in this case)
Still this part:
# if ($pag['page_begin']>$sys['now_offset'])
# {
#     $pag['page_text'] = $L['pag_notavailable'].sed_build_timegap($sys['now_offset'], $pag['page_begin_noformat']);
#     $t->assign("PAGE_TEXT", $pag['page_text']);
#     }
# else
# {

Is in page,inc.php, but not in list.inc.php ??
So maybe this should be there ???? (why in page and not in list)
==- I say: Keep it EZ -==
Kilandor
#6 1. Januar 2010, 18:56
<!-- IF {PHP.usr.id}={PHP.pag.page_ownerid} OR {PAGE_AVAILABLE}="1" OR {PHP.usr.isadmin}="1" -->
That should work