คือ ผมได้หัดเขียน django มาหลายวันแล้วรู้สึกว่า งง กับการเชื่อมลิงค์ครับ เช่น สมมติว่าผม
สรา้งหน้า template ขึ้นมาหนึ่ง เพื่อที่เอาไว้หน้าอื่นสืบทอดคุณสมบัติไปใช้งาน จะได้ดังนี้ครับ

template/
base.html/
temp.html
temp2.html
สมมติว่าผมต้องที่จะให้หน้า temp.html ลิงค์ไป temp2.html (กลับไปกลับมา (โดยพื้นฐานhtml จะใช้ ))ภายโค็ด แต่ผมได้ทดลองแล้วมัน ยัง error อยู่ครับไม่ทราบเป็นเพราะอะไร(ผมได้ทดลองลิงค์ไปข้ามนอก เช่น google.comm)มันทำงานได้นะครับ

                     ขอบคุณไว้ ณ ที่นี้ครับ....

Hiring! บริษัทที่น่าสนใจ

Carmen Software company cover
Carmen Software
Hotel Financial Solutions
Next Innovation (Thailand) Co., Ltd. company cover
Next Innovation (Thailand) Co., Ltd.
We are web design with consulting & engineering services driven the future stronger and flexibility.
KKP Dime company cover
KKP Dime
KKP Dime บริษัทในเครือเกียรตินาคินภัทร
Kiatnakin Phatra Financial Group company cover
Kiatnakin Phatra Financial Group
Financial Service
Fastwork Technologies company cover
Fastwork Technologies
Fastwork.co เว็บไซต์ที่รวบรวม ฟรีแลนซ์ มืออาชีพจากหลากหลายสายงานไว้ในที่เดียวกัน
Thoughtworks Thailand company cover
Thoughtworks Thailand
Thoughtworks เป็นบริษัทที่ปรึกษาด้านเทคโนโยลีระดับโลกที่คว้า Great Place to Work 3 ปีซ้อน
Iron Software company cover
Iron Software
Iron Software is an American company providing a suite of .NET libraries by engineer for engineers.
CLEVERSE company cover
CLEVERSE
Cleverse is a Venture Builder. Our team builds several tech companies.
Nipa Cloud company cover
Nipa Cloud
#1 OpenStack cloud provider in Thailand with our own data center and software platform.
Bangmod Enterprise company cover
Bangmod Enterprise
The leader in Cloud Server and Hosting in Thailand.
CIMB THAI Bank company cover
CIMB THAI Bank
MOVING FORWARD WITH YOU - CIMB is the leading ASEAN Bank
Bangkok Bank company cover
Bangkok Bank
Bangkok Bank is one of Southeast Asia's largest regional banks, a market leader in business banking
MuvMi (Urban Mobility Tech Co.,Ltd.) company cover
MuvMi (Urban Mobility Tech Co.,Ltd.)
Shape the future of urban mobility towards affordable, clean, and safe solutions
T.N. Digital Solution Co., Ltd. company cover
T.N. Digital Solution Co., Ltd.
TNDS has been involving in every first move of banking’s major digital transformation.
KBTG - KASIKORN Business-Technology Group company cover
KBTG - KASIKORN Business-Technology Group
KBTG - "The Technology Company for Digital Business Innovation"
Siam Commercial Bank Public Company Limited company cover
Siam Commercial Bank Public Company Limited
"Let's start a brighter career future together"
Icon Framework co.,Ltd. company cover
Icon Framework co.,Ltd.
Global Standard Platform for Real Estate แพลตฟอร์มสำหรับธุรกิจอสังหาริมทรัพย์ครบวงจร มาตรฐานระดับโลก
REFINITIV company cover
REFINITIV
The Financial and Risk business of Thomson Reuters is now Refinitiv
H LAB company cover
H LAB
Re-engineering healthcare systems through intelligent platforms and system design.
The Gang Technology Co., Ltd. company cover
The Gang Technology Co., Ltd.
We're a Digital Agency that helps our customers transform their business into digital with ease.
LTMH company cover
LTMH
LTMH มุ่งเน้นการพัฒนาผลิตภัณฑ์ที่สามารถช่วยพันธมิตรของเราให้บรรลุเป้าหมาย
Seven Peaks company cover
Seven Peaks
We Drive Digital Transformation
Wisesight (Thailand) Co., Ltd. company cover
Wisesight (Thailand) Co., Ltd.
The Best Choice For Handling Social Media · High Expertise in Social Data · Most Advanced and Secure
MOLOG Tech company cover
MOLOG Tech
We are Modern Logistic Platform, Specialize in WMS, OMS and TMS.
Data Wow Co.,Ltd company cover
Data Wow Co.,Ltd
We enable our clients to realize increased productivity by solving their most complex issues by Data
LINE Company Thailand company cover
LINE Company Thailand
LINE, the world's hottest mobile messaging platform, offers free text and voice messaging + Call
LINE MAN Wongnai company cover
LINE MAN Wongnai
Join our journey to becoming No.1 food platform in Thailand

-ไม่เข้าใจคำถาม ลองพยายามเรียบเรียงให้เข้าใจง่ายขึ้น
-ลองเอา code มาให้ดูก็ได้
-พยายามใช้ภาษาไทยให้ถูกต้อง

เท่าที่ผมพยายามทำความเข้าใจนะ หมายถึงให้ temp.html include ไปยัง temp2.html และ temp2.html include ไปที่ teml.html ใฃ่หรือไม่ครับ ถ้าอย่างนั้นก็คงทำไม่ได้ ลองพยายามออกแบบใหม่

หมายความว่าสร้าง link ไปที่หน้า html ตรงๆรึเปล่า? อย่างนี้ทำไม่ได้ครับ ต้องสร้าง url ไว้ในไฟล์ urls.py ซึ่งมันจะไปเรียก function ในไฟล์ views.py แล้วใน function นั้นค่อยระบุว่าจะ render_to_response ไปที่ template ไหน (temp.html หรือ temp2.html)

django เป็น framework ซึ่งจะต่างกับ php ซึ่งเป็นเพียงการลิงค์ไปยังไฟล์ script ต่างๆครับ

function ในไฟล์ views.py นั้นก็มักจะเอาไว้เรียกข้อมูลจากฐานข้อมูลขึ้นมาแสดง ทำโน่นทำนี่ ก่อนที่จะมาระบุในไฟล์ template ว่าจะให้แสดงตรงไหนน่ะครับ

som2526_1 Thu, 07/01/2010 - 21:28

-ใช้ๆๆ ครับความหมายเดียวกันกับ ทา่น panuta ครับ หมายความว่าสร้าง link ไปที่หน้า html ตรงๆ คือผมสร้าง url ไว้ในไฟล์ urls.py ซึ่งมันจะไปเรียก function ในไฟล์ views.py แล้วใน function นั้นค่อยระบุว่าจะ render_to_response ไปที่ template ไหน **ไม่เข้าใจตรงนี้และครับ สมมติว่า ผมมีหน้า x1.html และ x2.html
-x1.html
<a hef="x2.html">go to page x2 </a>

-x2.html
<a hef="x1.html">go to page x1 </a>

              มีต่อ >>

(ต่อครับ)

ประมาณว่าผมต้องการเอาเม้าร์ไปคลิ๊กที่ แสดงหน้า go to page x2 แล้วมันต้องแสดงหน้า go to page x1
(คลิ๊กกลับไปกลับมาได้ครับ)แบบนี้ต้องทำอย่างไรครับ ช่วยยกตัวอย่างด้วยครับ งง มาหลายวันแล้วครับ(ถ้าจะให้ดีของ souce code ตัวอย่างด้วยก็ดีครับ som2526_1@hotmail.com)
ตอนนี้ลองทำได้ ประมาณวา
mysite{
template{polls{index.html, detail.html}}
urls.py
manage.py
settings.py
polls{admin.py models.py views.py }
}
คือตอนนี้ผม config url.py , manage.py, setting.py ได้แล้วครับทำงานได้ด้วย คือ งง ตรงที่สมมติว่าผม รัน server ขึ้นมาปับ ผมก็ต้องอ้าง path สมมติว่าเป็น http://127.0.0.1:8000/polls มันก็จะขึ้นหน้าที่ผมตั้งใว้ใน ไฟล์ urls.py (r'^polls/$', 'mysite.polls.views.index) ก็จะเป็นหน้า index.html แสดง

*** คำถามที่ต้องการคำตอบคือ ตอนที่นี้ index.html แสดงอยู่ เราสามารถที่จะใส่ลิงค์(ที่เอาเม้าร์คลิ๊กได้)<a hef="detail.html">go to page detail</a> เพื่อที่ให้มันสามารถที่จะแสดงหน้า detail.html ได้ไหมครับ หรือจะมีวิธีอย่างอืนที่ทำได้ไหมครับช่วยชี้แนะด้วยครับ
อ่านจาก -->>http://docs.djangoproject.com/en/1.1/intro/tutorial03/#intro-tutorial03

บริษัทไหนที่ต้องการ programmer python ติดต่อผมได้นะครับ ยังหางานเขียน python ไม่ได้เลยไม่อยากเปลียมแนวไปเขียนภาษาอืน (ชอบเขยีนไพธอนมากๆๆ โปรเจคจบเขียนด้วยไพธอนครับ(app)ตอนนี้กำลังเล่น django อยู่ครับ ***เริ่มทำงานได้ทันที่ครับ)

                     ขอบคุณใว้ ณ ที่นี้นะครับ ท่านจอมยุทธทั้งหลาย

ทำได้เแล้ว เข้าหลักการแล้ว ไม่ต้องตอบก็ได้ ครับ หรือ ตอบเพื่อเป็นวิทยาทาน กับคนที่ติดได้ดีนะครับ

ถามตัวเองตอบตัวเอง นี้เลยครับ http://docs.djangoproject.com/en/1.1/topics/templates/#topics-templates

บทย่อนะครับ
ประมาณว่าเอาง่ายๆๆ นะครับ คือเราต้องทดลองแบบนี้ครับ

  1. สรา้ง template ขึ้นมา สมมติว่า คือ base.html(โค๊ดเปิดดูที่ลิงค์ด้านบนครับจะมีอยู่ครับ) (เก็บใว้ที่ --> /home/somkid/Desktop/sanook/web/mysite/templates) แล้วต้องมีการบอก web เราว่า template ของเราเก็บไว้ที่ไหน โดยการเข้าไปแก้ settings.py
    TEMPLATE_DIRS = (
    '/home/somkid/Desktop/sanook/web/mysite/templates' ) <--ทำแบบนี้ web เรามันจะรู้เองครับ ไม่ต้อง งง นะ

2.เราลองใส่สร้าง folder ชื่อ polls ก็จะได้ประมาณนี้ครับ'/home/somkid/Desktop/sanook/web/mysite/templates/polls' ต่อไปนี้ครับ ลองสรา้ง index.html (ใส่โค็ดเอานี้ลงไปเลยครับ
{% extends "base.html" %}

{% block title %}My amazing blog{% endblock %}

{% block content %}
{% for entry in blog_entries %}

{{ entry.title }}

{{ entry.body }}

{% endfor %}
{% endblock %} )

  1. แน่นอนรันมันจะ error นะเพราะเรายังทำไม่ครบไงครับ ต่อๆๆ แก้ไขอีกรอบนะโดยการเข้าไปแก้ settings.py ใส่นี้ลงไปเลยครับ
    INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.admin',
    'mysite.polls', # <--- OHh
    )

4.เป็นอันว่าเส็จแล้วครับ รันมันเลยครับด้วย python manage.py runserver
5.ดูหน่อยดิว่าออกมาถูกต้องใหมเอ๋ย (http://127.0.0.1:8000/polls)
ุ6.สังเกตจากการเปลียมแปลงครับ (ไม่ได้สอนนะครับ แต่เผื่อมีคนติดครับ)
ถ้ายังมีข้อผิดพลาด (please comment) บอกด้วยนะครับ หรือ mail::som2526_1@hotmail.com