Jump to content

Marvin

Members
  • Posts

    2
  • Joined

  • Last visited

Marvin's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Marvin

    Simple Gallery.

    Hello there. I am trying to create a simple gallery system, nothing too advanced.What I have in mind is, to list some thumbnail links, with values (which would resemble the image name) that would be sent to another script, and replace a variable there (ie: echo '<img src="mygallery/' . $img . '.jpg">') and thus, just display that image.Is this possible? Since i'm not much of a php coder.Thanks in advance.
  2. Marvin

    Hey!

    I am an admin of an anime website. And well, I'm trying to refresh some php. We were uploading some manga chapters, which so far are around 438 in total. So I was thinking: "Let me use this opportunity to practice some php."As you know, coding the links to 438 different urls with different names in pure html can be quite a pain. So I decided to make a simple generator to generate the codes for me.Here's what I have so far: <?php$linkzorz = 1;$html = '<a href="http://myplace.net/mangadir/manga-';$counter = 1;do {echo $html . $linkzorz . '.zip' . '">Chapter ' . $linkzorz . '</a><br />';$counter ++;$linkzorz ++;}While ($counter <= 438);?> The code is flawless,Reading that, you can see that it will generate 438 lines of the hyperlink code, with variable numbers which increase each time.My problem is that, the chapters are named in the following way: chapter-001, chapter-022, chapter-333.Therefore I assume that I may use the if statement to add '00' in front of $linkzorz if there is one digit, else if add '0' if there's 2 digits, and just leave it as normal if there's three digits.My question is: "How may I tell php the number of digits in a variable? =[" ( I know this may sound basic. )But that is why I can't make the code. :)Any suggestions?Thanks in advance.
×
×
  • Create New...