Howdy again, I'm now wanting to make discussion pages for each resource page in the wiki (not unlike those of wikipedia). I want to know how to automatically add a page whenever a file is saved, so that if someone makes a new page on the wiki it will automatically make a discussion page for it. I also need to know how to link to a page with the URL of the current page + something. Like if someone was at
<!-- m --><a class="postlink" href="http://edandben.snipenut.com/index.php?page=QwikiSyntax">http://edandben.snipenut.com/index.php?page=QwikiSyntax</a><!-- m -->
it would send them to
<!-- m --><a class="postlink" href="http://edandben.snipenut.com/index.php?page=QwikiSyntaxDiscuss">http://edandben.snipenut.com/index.php? ... taxDiscuss</a><!-- m -->
or something similar.
Thanks again :rocker:add a page to what?
if they save a page then you need to search in that directory for all pages. thsi way you can get all of them and add what ever you want to them.
look into
opendir() (<!-- m --><a class="postlink" href="http://www.php.net/manual/en/function.opendir.php">http://www.php.net/manual/en/function.opendir.php</a><!-- m -->)Awsome scoutt, this is exactly what I need!
thank you yet again I just figured out something a little tweakish about the discussion like
Say you're at
<!-- m --><a class="postlink" href="http://edandben.snipenut.com/index.php?page=Home">http://edandben.snipenut.com/index.php?page=Home</a><!-- m -->
and you click on discussion, you then go to
<!-- m --><a class="postlink" href="http://edandben.snipenut.com/index.php?page=HomeDiscussion">http://edandben.snipenut.com/index.php? ... Discussion</a><!-- m -->
if you click on discussion again you go to
<!-- m --><a class="postlink" href="http://edandben.snipenut.com/index.php?page=HomeDiscussionDiscussion">http://edandben.snipenut.com/index.php? ... Discussion</a><!-- m -->
is there a way to see if a string has the word discussion in it and use it in an if command so I can only show the discussion link if there isn't the word discussion already in the string?
btw, the code for the discussion link:
echo ' | <a href=http://edandben.snipenut.com/index.php?page=' . $QW[page] . 'Discussion>Discussion</a>';whoo hoo, bit by bit the site is coming together, not to mention this is the fastest I've ever learned a language erg, I just realized i don't know how to create a new file I looked on php.net but couldn't find anything on it. could someone just give me the command or a link to it on php.net that's for making a new file?
thank's for helpin'fopen() (<!-- m --><a class="postlink" href="http://www.php.net/manual/en/function.fopen.php">http://www.php.net/manual/en/function.fopen.php</a><!-- m -->)
and to see if you already had the word in it you can use strpos() (<!-- m --><a class="postlink" href="http://www.php.net/manual/en/function.strpos.php">http://www.php.net/manual/en/function.strpos.php</a><!-- m -->)alright, I got the if, but it keeps returning a parse error and for the life of me I have no clue why.<?php
echo QWFormatHTMLList( $QW_TEMPLATE['commandList']( ), " | " );
$thispage = $QW[page]
$discuss = 'discuss'
$discfind = strpos($thispage, $discuss)
if ($discfind == false)
echo ' | <a href=http://edandben.snipenut.com/index.php?page=' . $QW[page] . 'Discussion>Discussion</a>';
?>It says the parse error is on the if ($discfind == false) line, but I have no idea what is wrong with it. I've tried putting the entire THEN part of it in brackets but it gave me the same error, and I looked it up and it shouldn't need it because it's only doing one thing. Could someone tell me how to fix this line?$discfind = strpos($thispage, $discuss)
you forgot a semi-colon at the end of that linefor some reason it always returns false, do you know why this is?cause you need 3 equal signs.
if ($discfind === false)erg, its still doing it...
can I make $disc = 0 on the main page and $disc = 1 on the discussion page by having it in the URL? and if so, how?
thx for the massive help just do this
<?php
echo QWFormatHTMLList( $QW_TEMPLATE['commandList']( ), " | " );
$thispage = $QW[page]
$discuss = 'discuss'
if (!strpos($thispage, $discuss){
echo ' | <a href=http://edandben.snipenut.com/index.php?page=' . $QW[page] . 'Discussion>Discussion</a>';
} else {
echo ' | <a href=http://edandben.snipenut.com/index.php?page=' . $QW[page] . '>Discussion</a>';
}
?>erg, it's still doing it. I have no idea why, it's almost like it's completely ignoring the if and else.<?php
echo QWFormatHTMLList( $QW_TEMPLATE['commandList']( ), " | " );
$thispage = $QW[page];
$discuss = 'discuss';
if (!strpos($thispage, $discuss)) {
echo ' | <a href=http://edandben.snipenut.com/index.php?page=' . $QW[page] . 'Discussion>Discussion</a>';
} else {
echo ' | <a href=http://edandben.snipenut.com/index.php?page=' . $QW[page] . '>Discussion</a>';
}
?> I had to tweak it a little 'cause it was giving me errors (about the parenthesis in the IF) but this is what I have now.
do you see anything wrong with this at all? when this get's fixed I'm sure it'll end up being an extra bracket or something ridiculus like that try this
if (eregi("discussion", $thispage)){
echo ' | <a href=http://edandben.snipenut.com/index.php?page=' . $QW[page] . '>Discussion</a>';
} else {
echo ' | <a href=http://edandben.snipenut.com/index.php?page=' . $QW[page] . 'Discussion>Discussion</a>';
}
or the way you were doing it is case-sensative so that is why it always returned false.
<!-- m --><a class="postlink" href="http://edandben.snipenut.com/index.php?page=QwikiSyntax">http://edandben.snipenut.com/index.php?page=QwikiSyntax</a><!-- m -->
it would send them to
<!-- m --><a class="postlink" href="http://edandben.snipenut.com/index.php?page=QwikiSyntaxDiscuss">http://edandben.snipenut.com/index.php? ... taxDiscuss</a><!-- m -->
or something similar.
Thanks again :rocker:add a page to what?
if they save a page then you need to search in that directory for all pages. thsi way you can get all of them and add what ever you want to them.
look into
opendir() (<!-- m --><a class="postlink" href="http://www.php.net/manual/en/function.opendir.php">http://www.php.net/manual/en/function.opendir.php</a><!-- m -->)Awsome scoutt, this is exactly what I need!
thank you yet again I just figured out something a little tweakish about the discussion like
Say you're at
<!-- m --><a class="postlink" href="http://edandben.snipenut.com/index.php?page=Home">http://edandben.snipenut.com/index.php?page=Home</a><!-- m -->
and you click on discussion, you then go to
<!-- m --><a class="postlink" href="http://edandben.snipenut.com/index.php?page=HomeDiscussion">http://edandben.snipenut.com/index.php? ... Discussion</a><!-- m -->
if you click on discussion again you go to
<!-- m --><a class="postlink" href="http://edandben.snipenut.com/index.php?page=HomeDiscussionDiscussion">http://edandben.snipenut.com/index.php? ... Discussion</a><!-- m -->
is there a way to see if a string has the word discussion in it and use it in an if command so I can only show the discussion link if there isn't the word discussion already in the string?
btw, the code for the discussion link:
echo ' | <a href=http://edandben.snipenut.com/index.php?page=' . $QW[page] . 'Discussion>Discussion</a>';whoo hoo, bit by bit the site is coming together, not to mention this is the fastest I've ever learned a language erg, I just realized i don't know how to create a new file I looked on php.net but couldn't find anything on it. could someone just give me the command or a link to it on php.net that's for making a new file?
thank's for helpin'fopen() (<!-- m --><a class="postlink" href="http://www.php.net/manual/en/function.fopen.php">http://www.php.net/manual/en/function.fopen.php</a><!-- m -->)
and to see if you already had the word in it you can use strpos() (<!-- m --><a class="postlink" href="http://www.php.net/manual/en/function.strpos.php">http://www.php.net/manual/en/function.strpos.php</a><!-- m -->)alright, I got the if, but it keeps returning a parse error and for the life of me I have no clue why.<?php
echo QWFormatHTMLList( $QW_TEMPLATE['commandList']( ), " | " );
$thispage = $QW[page]
$discuss = 'discuss'
$discfind = strpos($thispage, $discuss)
if ($discfind == false)
echo ' | <a href=http://edandben.snipenut.com/index.php?page=' . $QW[page] . 'Discussion>Discussion</a>';
?>It says the parse error is on the if ($discfind == false) line, but I have no idea what is wrong with it. I've tried putting the entire THEN part of it in brackets but it gave me the same error, and I looked it up and it shouldn't need it because it's only doing one thing. Could someone tell me how to fix this line?$discfind = strpos($thispage, $discuss)
you forgot a semi-colon at the end of that linefor some reason it always returns false, do you know why this is?cause you need 3 equal signs.
if ($discfind === false)erg, its still doing it...
can I make $disc = 0 on the main page and $disc = 1 on the discussion page by having it in the URL? and if so, how?
thx for the massive help just do this
<?php
echo QWFormatHTMLList( $QW_TEMPLATE['commandList']( ), " | " );
$thispage = $QW[page]
$discuss = 'discuss'
if (!strpos($thispage, $discuss){
echo ' | <a href=http://edandben.snipenut.com/index.php?page=' . $QW[page] . 'Discussion>Discussion</a>';
} else {
echo ' | <a href=http://edandben.snipenut.com/index.php?page=' . $QW[page] . '>Discussion</a>';
}
?>erg, it's still doing it. I have no idea why, it's almost like it's completely ignoring the if and else.<?php
echo QWFormatHTMLList( $QW_TEMPLATE['commandList']( ), " | " );
$thispage = $QW[page];
$discuss = 'discuss';
if (!strpos($thispage, $discuss)) {
echo ' | <a href=http://edandben.snipenut.com/index.php?page=' . $QW[page] . 'Discussion>Discussion</a>';
} else {
echo ' | <a href=http://edandben.snipenut.com/index.php?page=' . $QW[page] . '>Discussion</a>';
}
?> I had to tweak it a little 'cause it was giving me errors (about the parenthesis in the IF) but this is what I have now.
do you see anything wrong with this at all? when this get's fixed I'm sure it'll end up being an extra bracket or something ridiculus like that try this
if (eregi("discussion", $thispage)){
echo ' | <a href=http://edandben.snipenut.com/index.php?page=' . $QW[page] . '>Discussion</a>';
} else {
echo ' | <a href=http://edandben.snipenut.com/index.php?page=' . $QW[page] . 'Discussion>Discussion</a>';
}
or the way you were doing it is case-sensative so that is why it always returned false.