Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Offline
#17 2007-12-09 16:20:16
- net-carver
- Archived Plugin Author
- Registered: 2006-03-08
- Posts: 1,648
Re: Set default admin tab
iblastoff
Thank you!
— Steve
Offline
Re: Set default admin tab
Hi Steve!
Inspired from you, I’d made your kind of asy_dashboard screen splash without your extra functions (lam_*).
If somebody is interested, here is the code :
<div id="dashboard" style="width:500px;margin:0 auto">
<h1 class="dashb_username">Welcome,<txp:php>
global $txp_user;
echo " " . $txp_user . "!";</txp:php><a href="index.php?logout=1" title="Logout" style="float:right">[logout]</a></h1>
<h3 class="dashb_date"><txp:php>
echo "Today's date ", date('d M Y');</txp:php></h3>
<p>Positive thought of the day : <br /><txp:php>
$q = 'SELECT COUNT(*) FROM '.PFX.'positive_thoughts';
$rs1 = getThing($q);
$rand_num = rand(1, $rs1);
$rs2 = safe_column('thought', 'positive_thoughts', 'id='.$rand_num.'');
foreach($rs2 as $thought) {
echo "“<b>$thought</b>”</p>";
}
</txp:php>
<hr />
<p class="dashb_lastmod">Website Last Modification On <txp:php>
$timestamp = $GLOBALS['prefs']['lastmod']; echo date("d M Y à H:i", strtotime($timestamp));</txp:php><br />
You are currently using TXP version <txp:php>
echo $GLOBALS['prefs']['version'] ." ";</txp:php></p>
<hr />
<h2 class="dashb_heading">Last 6 Articles : <br />( <txp:php>
$limit = 6;
$where = "Status='4' order by posted desc limit 0,$limit";
$q = 'SELECT COUNT(*) FROM '.PFX.'textpattern WHERE '.$where;
$rs = getThing($q);
echo( ($rs ? $rs : '0') );
</txp:php> total published - and <txp:php>
$nbre = safe_rows('*', 'textpattern', 'Section = "blog"');
echo count($nbre);</txp:php> articles within your "Blog" pages)</h2>
<div class="dashb_list"><txp:asy_dabo_articles limit="5" /></div>
<hr />
<txp:php>
$nbre = safe_rows('*', 'textpattern', 'Status < 4');
$nbre = count($nbre);
if(!empty($nbre)) {
echo '<h2 class="dashb_heading"><a href="#nogo" title="Toggle/Show" onclick="toggleDisplay(\'draft\'); return false;">'.$nbre.' Non Published Articles</a> :</h2>';
echo "\r";
echo '<div class="dashb_list" id="draft" style="display:none">';
echo asy_dabo_articles(array('limit'=>99,'draft'=>1));
echo "</div>\r";
} else {
echo "<h2>You have any non published articles</h2>";
}
</txp:php>
<hr />
<h2 class="dashb_heading"><a href="#nogo" title="Toggle/Show" onclick="toggleDisplay('photos'); return false;">More Showing Articles</a>:</h2>
<div class="dashb_list" id="photos" style="display:none">
<txp:output_form form="most_viewed_articles" />
</div>
<hr />
<h2 class="dashb_heading">Comments to be validate ( <txp:php>
$limit = 10;
$where = "visible='0' limit 0,$limit";
$q = 'SELECT COUNT(*) FROM '.PFX.'txp_discuss WHERE '.$where;
$rs = getThing($q);
echo( ($rs ? ($rs == 1 ? $rs.' total comment' : $rs.' total comments') : 'No comments yet') );
</txp:php> ) :</h2>
<div class="dashb_list"><txp:asy_dabo_comments pending="1" limit="10" /></div>
<h2 class="dashb_heading">Your Last 6 Comments ( <txp:php>
$where = "visible='1'";
$q = 'SELECT COUNT(*) FROM '.PFX.'txp_discuss WHERE '.$where;
$rs = getThing($q);
echo( ($rs ? ($rs == 1 ? $rs.' total comment' : $rs.' total comments') : 'No Comments Yet') );
</txp:php> ) :</h2>
<div class="dashb_list"><txp:asy_dabo_comments limit="6" /></div>
<hr />
<div id="dashb_footer">
<p style="text-align:center"><a href="http://textbook.textpattern.net/" title="Go to TextBook" target="_blank">Textbook</a> - <a href="http://forum.textpattern.com/search.php?action=show_24h" title="Last 24h help forums treads" target="_blank">Support Forums</a></p>
</div> <!-- /dash_footer -->
</div> <!-- /dashbord -->
And here is my “most_viewed_articles” form :
<p><txp:php>
$limit = 15;
$link = safe_rows('ID,Title, url_title, request_count', 'textpattern', "request_count order by request_count desc limit 0,".$limit);
foreach($link as $id => $valeur) {
echo "<a href=\"".hu."textpattern/index.php?event=article&step=edit&ID=".$link[$id][ID]."\" title=\"Go to write tab for this article\">".$link[$id][Title]." (shown ".$link[$id][request_count]." times)</a><br />\r";
}
</txp:php></p>
Obviously, you need rsx_request_count plugin by Ramanan Sivaranjan.
Cheers,
Last edited by Pat64 (2007-12-10 20:15:43)
Patrick.
Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.
Offline
#19 2007-12-11 05:42:05
- net-carver
- Archived Plugin Author
- Registered: 2006-03-08
- Posts: 1,648
Re: Set default admin tab
All
just posted my first effort using the dashboard plugin in this thread.
Iblastoff
It’s not too difficult to stop the Content and Write tabs being highlighted by default. Just do $event = 'your_dashboard_event'; before the dashboard plugin code starts rendering pagetop().
— Steve
Offline
#20 2008-02-22 12:03:30
- masa
- Member
- From: North Wales, UK
- Registered: 2005-11-25
- Posts: 1,095
Re: Set default admin tab
marios wrote:
This will make the articles page load on default index.php request.
Thanks Marios,
I just came across this – perfect!
Offline