Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Questions and Supports (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=18)
-   -   Making Link Pop up in Iframe? (http://www.mysidiaadoptables.com/forum/showthread.php?t=4545)

Hwona 06-17-2014 09:16 PM

Making Link Pop up in Iframe?
 
Hello everyone, I've been trying to get the links of daycare pets to pop up in an iframe on the page when clicked, but I can't seem to find a way to link the php link to a target and when I try to use a html like and replace the id with a variable, the page pops up blank.
Here's the code for the daycare function(v.1.3.3):
PHP Code:

    public function daycare(){
        
$mysidia Registry::get("mysidia");
        
$document $mysidia->frame->getDocument();
        
$document->setTitle($mysidia->lang->daycare_title);
        
$document->addLangvar($mysidia->lang->daycareTRUE);
        
        try{
            
$daycare = new Daycare;
            
$adopts $daycare->getAdopts();
        }
        catch(
DaycareException $dae){
            
$message $dae->getmessage();
            
$document->addLangvar($mysidia->lang->{$message});
            return;
        }
        
        
$daycareTable = new Table("daycare"""FALSE);
        
$daycareTable->setBordered(FALSE);
        
$total $daycare->getTotalAdopts();
        
$index 0;

        for(
$row 0$row $daycare->getTotalRows(); $row++){
            
$daycareRow = new TRow("row{$row}");
            for(
$column 0$column $daycare->getTotalColumns(); $column++){
                
$adopt = new OwnedAdoptable($adopts[$index]);
             
$image = new Link("levelup/click/{$adopt->getAdoptID()}"$adopt->getImage("gui"), TRUE);
                
$stats = new Comment($daycare->getStats($adopt));
                
$daycareCell = new TCell(new ArrayObject(array($image)), "cell{$index}");
                
$message1 "<iframe name='iframe1' src='levelup/click/{$adopt->getAdoptID()}'></iframe>";
                
$daycareCell->setAlign(new Align("center""center"));
                
$daycareRow->add($daycareCell);
                
$index++;
                if(
$index == $total) break;
            }
            
$daycareTable->add($daycareRow);            
        }
        
        
$document->add($daycareTable);
        
$document->addLangvar($message1);
        if(
$pagination $daycare->getPagination()) $document->addLangvar($pagination->showPage());
    }


Thanks! :D

Hall of Famer 06-18-2014 04:44 AM

Have you played with the IFrame class/object? It may do the trick.

Hwona 06-18-2014 08:20 AM

Mmm, I tried that, but I don't think I'm using it correctly since it always returns "this is the Iframe class" instead of an iframe... this is used to build an iframe right?
I tried changing the code to this:
PHP Code:

 for($column 0$column $daycare->getTotalColumns(); $column++){
             
$target "iframe";
                
$adopt = new OwnedAdoptable($adopts[$index]);
             
$image = new Link("levelup/click/{$adopt->getAdoptID()}"$adopt->getImage("gui"), TRUE);
             
$image->setTarget($target);
                
$stats = new Comment($daycare->getStats($adopt));
                
$daycareCell = new TCell(new ArrayObject(array($image)), "cell{$index}");
                
$message1 "<iframe name='{$target}' src='levelup/click/{$adopt->getAdoptID()}'></iframe>";
                
$daycareCell->setAlign(new Align("center""center"));
                
$daycareRow->add($daycareCell);
                
$index++;
                if(
$index == $total) break; 

This shows on the page: Welcome to Daycare Center, here you can help with the growth of these cute baby adoptables.
The link target is invalid...
I also tried this and go the same message:
PHP Code:

 for($column 0$column $daycare->getTotalColumns(); $column++){
                
$adopt = new OwnedAdoptable($adopts[$index]);
             
$image = new Link("levelup/click/{$adopt->getAdoptID()}"$adopt->getImage("gui"), TRUE);
             
                
$stats = new Comment($daycare->getStats($adopt));
                
$daycareCell = new TCell(new ArrayObject(array($image)), "cell{$index}");
                
$iframe = new IFrame($name "iframe"$src "levelup/click/{$adopt->getAdoptID()}"$width ""$height ""$event "");
                
$image->setTarget($name);
                
$daycareCell->setAlign(new Align("center""center"));
                
$daycareRow->add($daycareCell);
                
$index++;
                if(
$index == $total) break;
            }
            
$daycareTable->add($daycareRow);            
        } 


Hwona 06-19-2014 03:45 PM

Am I using the target function correctly on the second code? I have no clue... XP

IntoRain 06-20-2014 10:01 PM

What you want to do is direct each adoptable link to the same Iframe, not create an Iframe for each adoptable.

Inside the for cycle, you just need to add that target to the link, and don't forget to put a / before levelup ( like /levelup/click/{$adopt->getAdoptID())

Outside the cycle, for example, you add the iframe, it can have an empty source

$document->add($daycareTable);
$document->add(new Comment("<iframe name='iframe' src=''></iframe>"));

Hwona 06-21-2014 11:02 AM

Re
 
Thank you! Actually, my problem is targetting... I don't know how to set the target to the iframe, the page gives me and error...

IntoRain 06-22-2014 08:14 AM

Setting the target to the iframe is putting a target='iframe_name' in your links. Does the setTarget you use exist? Since this is 1.3.3 I can't really test it x.x But in 1.3.4, instead of using the Link object I used HTML in a Comment object. Not sure if this would work in 1.3.3

PHP Code:

for($row 0$row $daycare->getTotalRows(); $row++){
            
$daycareRow = new TRow("row{$row}");
            for(
$column 0$column $daycare->getTotalColumns(); $column++){
                
$adopt = new OwnedAdoptable($adopts[$index]);
                
$cell = new ArrayList;
                
$cell->add(new Comment("<a href='/levelup/click/{$adopt->getAdoptID()}' target='iframe'><img src='{$adopt->getImage()}'></a>"));
                
$cell->add(new Comment($daycare->getStats($adopt)));
                
$daycareCell = new TCell($cell"cell{$index}");
                
$daycareCell->setAlign(new Align("center""center"));
                
$daycareRow->add($daycareCell);
                
$index++;
                if(
$index == $total) break;
            }
            
$daycareTable->add($daycareRow);            
        }
        
        
$document->add($daycareTable);
        
$document->add(new Comment("<iframe name='iframe' src=''></iframe>")); 


Hwona 06-22-2014 09:58 AM

I actually tried something similar, but the page would break before. XP
Now, the page shows up with this message:

Welcome to Daycare Center, here you can help with the growth of these cute baby adoptables.
Fatal Error: Class ArrayList either does not exist, or has its include path misconfigured!

Hwona 06-27-2014 10:52 PM

Is there such a function in v.1.3.3? Would you mind telling me where to find it to check if it's there?(class page) :3

IntoRain 06-28-2014 09:11 AM

Probably ArrayLists don't exist in that version. Maybe turning the image variable into a Comment object (similar to the Comment I use in my code) instead of a Link object?

Hwona 06-28-2014 11:24 AM

I see... I tried, but the page breaks. :L Umm, do you know what arraylists do?

Hwona 07-02-2014 12:22 PM

Is there an alternative to using an arraylist? That needs to be there right? Umm... do you think it would be possible to add the code to v.1.3.3?


All times are GMT -5. The time now is 04:07 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.