Difference between revisions of "Lyriki talk:Software"

From Lyriki
Jump to navigation Jump to search
(Exporting Pages)
Line 67: Line 67:
  
 
Example: http://lyriki.com/index.php?title=User:MindlessXD&action=raw&ctype=text/javascript
 
Example: http://lyriki.com/index.php?title=User:MindlessXD&action=raw&ctype=text/javascript
 +
 +
Boy, if I was smart, I would of known about this and used it instead of trying to parse the HTML that the browser retrieves lol --[[User:Nanenj|Nanenj]] 19:13, 11 January 2006 (PST)

Revision as of 20:13, 11 January 2006

PHP Scripts

I've written a couple of simple PHP scripts to make song and album list creation easier... use them however you want. --MindlessXD 16:07, 9 January 2006 (PST)

Thanks for the contribution, hopefully there's much more to come. Glad to see something by someone else so soon :) --Nanenj 16:32, 9 January 2006 (PST)

<?php
if (isset($_POST['artist']) && isset($_POST['songs'])) {
  $artist = $_POST['artist'];
  $songs = $_POST['songs'];
} else $artist = $songs = '';
?>
<html>
<head>
</head>
<body>
  <form action="<? echo $_SERVER['PHP_SELF']; ?>" method="post">
  <input name="artist" type="text" value="<? echo $artist; ?>" /><br />
  <textarea name="songs" rows="25" cols="80"><? echo $songs; ?></textarea><br />
  <input name="submit" type="submit" /><br />
  </form>
<?
if (isset($_POST['artist']) && isset($_POST['songs'])) {
  echo '<pre>' . "\n";
  $songs = split('[' . "\r" . "\n" . ']', $songs);
  foreach ($songs as $k => $null) {
    if ($songs[$k] != '') echo '# [[' . $artist . ':' . $songs[$k] . '|' . $songs[$k] . ']]' . "\n";
  }
  echo '</pre>' . "\n";
}
?>
</body>
</html>
<?php
if (isset($_POST['artist']) && isset($_POST['albums']) && isset($_POST['years'])) {
  $artist = $_POST['artist'];
  $albums = $_POST['albums'];
  $years = $_POST['years'];
} else $artist = $albums = $years = '';
?>
<html>
<head>
</head>
<body>
  <form action="<? echo $_SERVER['PHP_SELF']; ?>" method="post">
  <input name="artist" type="text" value="<? echo $artist; ?>" /><br />
  <textarea style="margin-right:1px;" name="years" rows="25" cols="6"><? echo $years; ?></textarea><textarea name="albums" rows="25" cols="74"><? echo $albums; ?></textarea><br />
  <input name="submit" type="submit" /><br />
  </form>
<?
if (isset($_POST['artist']) && isset($_POST['albums']) && isset($_POST['years'])) {
  echo '<pre>' . "\n";
  $albums = split('[' . "\r" . "\n" . ']', $albums);
  $years = split('[' . "\r" . "\n" . ']', $years);
  if (count($albums) == count($years)) {
    foreach ($albums as $k => $null) {
      if ($albums[$k] != '' && $years[$k] != '') echo '* ' . $years[$k] . ' [[' . $artist . ':' . $albums[$k] . ' (' . $years[$k] . ')|' . $albums[$k] . ']]' . "\n";
    }
  } else echo 'MISMATCH';
  echo '</pre>' . "\n";
}
?>
</body>
</html>

Exporting Pages

Example: http://lyriki.com/index.php?title=User:MindlessXD&action=raw&ctype=text/javascript

Boy, if I was smart, I would of known about this and used it instead of trying to parse the HTML that the browser retrieves lol --Nanenj 19:13, 11 January 2006 (PST)